Create linked data structures from array

DebraB

New Member
I am new to linked data structures and was wondering how to create an undirected graph when given 2 points from a 2d array and no weight determined between the points. I've searched around and couldn't really find what I was looking for.Example:\[code\]int[][] points = { { 0, 1 },{ 0, 2 },{ 1, 2 },{ 1, 3 },{ 3, 4 } };\[/code\]Drawn out it should look like this.\[code\] 0 | ------- | | 1-----2 | 3-----4 \[/code\]EDITI also want to be able to find the shortest path from 0 to 4 and traversing to each point at least once while counting each move along the way. There is the possibility that you may have to move backwards. In above example, the shortest path from 0 - 4 is (0-2)(2-1)(1-3)(3-4) and counts to be 4 moves.
 
Top