Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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.