Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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
share|improve this question

1 Answer 1

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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