Class Libraries - Drawing Edges

Jan 24, 2015 at 6:34 PM
Edited Jan 24, 2015 at 6:34 PM
I have imported an excel worksheet which was gathered using the Facebook api through the NodeXL Template(just using the template for now to gather data, later I would like to interact with the FB api using the class libraries not the template.).

I have drawn the Vertices without any issue. Although I'm finding it a little tricky to match up the edges using the imported data in the excel file. The data in the excel file is laid out in the Edges worksheet like:

Vertex A | Vertex D
Vertex F | Vertex G
Vertex B | Vertex A
Vertex M | Vertex T
Vertex A | Vertex S

I am new to the NodeXL class libraries and am still playing around with them but could anyone help me out with this.

Due to the data being Different each time I download a FB friends list using the template and along with the edge worksheet having around 5000K rows, how do you identify each Vertex uniquely? Does the class libraries have a way or doing this so the edges can be easily coded.

For examples, I cant have each edge statically defined in my code as there are too many edges to make this logical:
IEdge oEdge1 = oEdges.Add(oVertexA, oVertexD, true);
IEdge oEdge2 = oEdges.Add(oVertexF, oVertexG, true);
IEdge oEdge3 = oEdges.Add(oVertexB, oVertexA, true);
IEdge oEdge2 = oEdges.Add(oVertexM, oVertexT, true);
IEdge oEdge3 = oEdges.Add(oVertexA, oVertexS, true);
Once again, thanks to whoever takes the time to help me out,
Matt
Coordinator
Jan 29, 2015 at 4:45 PM
Hello Matt,

when a vertex is created it gets a unique ID for the graph which can be accessed through the ID property of the vertex. The same applies to edges.

Regards,
Arber
Jan 29, 2015 at 5:02 PM
Also, Matt, please note that there is a Smrf.NodeXL.Adapters.SimpleGraphAdapter class that will create a new graph for you by reading an edge list from a string, file, or stream, without your having to keep track of the vertices. You would use it something like this:

SimpleGraphAdapter simpleGraphAdapter = new SimpleGraphAdapter();
IGraph newGraph = simpleGraphAdapter.LoadGraphFromFile("C:\MyTabDelimitedFile.txt");
nodeXLControl.Graph = newGraph;

I don't know if that would be useful in your particular situation, but I wanted to mention it.

-- Tony
Jan 31, 2015 at 8:49 PM
Edited Feb 3, 2015 at 3:22 PM
arber wrote:
Hello Matt,

when a vertex is created it gets a unique ID for the graph which can be accessed through the ID property of the vertex. The same applies to edges.

Regards,
Arber
Hey Arber,
Thanks for for the advice on the edges I'll have a look further into the class libraries. :)
tcap479 wrote:
Also, Matt, please note that there is a Smrf.NodeXL.Adapters.SimpleGraphAdapter class that will create a new graph for you by reading an edge list from a string, file, or stream, without your having to keep track of the vertices. You would use it something like this:
SimpleGraphAdapter simpleGraphAdapter = new SimpleGraphAdapter();
IGraph newGraph = simpleGraphAdapter.LoadGraphFromFile("C:\MyTabDelimitedFile.txt");
nodeXLControl.Graph = newGraph;

I don't know if that would be useful in your particular situation, but I wanted to mention it.

-- Tony
Hey Tony,
I'll have a look at the simplegraphadaptor class.


.

EDIT:
I managed to get the edges working with the graph thanks to the advice of Arber and Tony, cheers guys.

Simple question(I'll have a look around and will probably find it out myself before you's have the chance to reply).

My graphing application is working grand and the clustering algorithm is doing its job, the only issue I'm having is that the clusters are very compact with names(vertex labels) overlapping each other. Is there any way to spread the clusters out a little so that the vertices dont overlap, allowing you to clearly see the edges; relationships between vertices?


Thanks,
Matt