フィルターのクリア

Adjacency matrix formation from n*n matrix

1 回表示 (過去 30 日間)
SANJOY MONDAL
SANJOY MONDAL 2019 年 7 月 10 日
コメント済み: SANJOY MONDAL 2019 年 7 月 11 日
I have a matrix
A= [ 1 2
1 3
1 4
2 3
2 4
3 4 ]
and another weight matrix W= [4, 2, 3, 1] i.e weight of the first pair of A is 4, second pair is 2 etc.
i want to output in the form
edgeData = [1 2 4; 2 3 2; 1 3 3; 1 4 1];

採用された回答

Guillaume
Guillaume 2019 年 7 月 10 日
edgeData = [A, W(:)]
Note that this is not an adjacency matrix.
Also, you may actually want to input that into a graph or digraph:
G = graph(A(:, 1), A(:, 2), W(:))
  1 件のコメント
SANJOY MONDAL
SANJOY MONDAL 2019 年 7 月 11 日
thank you sir

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSparse Matrices についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by