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

I have a list of pairs of numbers, representing connections between objects in the real world. Each number is the identifier of an object, there are gaps in the range from the smallest number to the largest number.


I need to visualise how all of the objects are related. I intended to create a graph representation of that network.

share|improve this question
Just curious: Have you tried looking this up in the built-in documentation (F1 on Windows) and if so, what problems did you encounter there? – Sjoerd C. de Vries Dec 15 '13 at 22:27

If you have a list

list = {{43, 292}, {22, 11}, {932, 11}, {292, 22}};

Then you can construct a Graph by

Graph[UndirectedEdge @@@ list, VertexLabels -> "Name"] 

enter image description here

share|improve this answer
+1, but I wonder how the OP missed the Graph[ ] docs – Dr. belisarius Dec 15 '13 at 22:59
Graph::supp: Mixed graphs and multigraphs are not supported. >> .. I tried eliminate duplicates with list = DeleteDuplicates[list, Equal[#1, #2] &] before executing the command you gave. – Pétur Dec 16 '13 at 0:16
@Pétur Try list = DeleteDuplicates[Sort/@ list, Equal[#1, #2] &] instead – Dr. belisarius Dec 16 '13 at 3:57

Your Answer


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.