1
$\begingroup$

Is it possible to import adjacency matrix for graph representation, from simple text file with NxN (rows x columns) of 0s/1s:

0 1 0 0
1 0 1 1
0 1 0 0
0 1 0 0
$\endgroup$
4
$\begingroup$

This is pretty much taken from the documentation of AdjacencyGraph

data =
  "0 1 0 0
  1 0 1 1
  0 1 0 0
  0 1 0 0";
AdjacencyGraph[ImportString[data], VertexLabels -> "Name", ImagePadding -> 10]

graph

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.