Message Boards Message Boards

0
|
4040 Views
|
4 Replies
|
3 Total Likes
View groups...
Share
Share this post:

How can I import a large dataset of vertex weights and edges?

Posted 11 years ago

I have about 9000 vertices, all with a numerical weight, and there are about 20000 unweighted edges connecting them. I need to create a graph from this data and eventually analyze the graph's properties (degrees, shortest paths, neighborhoods, etc.). A tiny sample of my edge and vertex data are in an attached excel file. Any suggestions would be greatly appreciated.

Attachments:
POSTED BY: Shawn Doyle
4 Replies
Posted 11 years ago

The only problem with this code is that it doesn't create a weighted graph. I still have yet to find out how to assign the vertex weights. I thought that I would replace VertexSize with VertexWeight and remove the 0.1, but this does not work. How can I incorporate the weights?

POSTED BY: Shawn Doyle

Tá fáilte romhat!

Interesting by the way that the Wolfram Cloud thinks that this is English:

Classify["Language","Go raibh maith agat!"]

gives:

 Entity[Language, English]

Here in Aberdeen they speak Doric and "you are welcome" would be:

"nae bather"

(no bother) which the machine learning in the Cloud also believes to be English. I suppose that it isn't trained on Irish or Doric and Scots texts.

Cheers, Marco

POSTED BY: Marco Thiel
Posted 11 years ago

Go raibh maith agat!

POSTED BY: Shawn Doyle

Hi,

these two commands might help:

data = Import["~/Desktop/VEtest.xlsx"]

Graph[Table[Property[data[[1]][[i, 2]], VertexSize -> 0.1*data[[1]][[i, 1]]], {i, 1, Length[data[[1]]]}], 
 Table[data[[2]][[i, 1]] \[UndirectedEdge] data[[2]][[i, 2]], {i, 1, Length[data[[2]]]}]]

They give something like this:

enter image description here

The standard graph measures should work:

 g = Graph[Table[Property[data[[1]][[i, 2]], VertexSize -> 0.1*data[[1]][[i, 1]]], {i, 1, Length[data[[1]]]}],
    Table[data[[2]][[i, 1]] \[UndirectedEdge] data[[2]][[i, 2]], {i, 1, Length[data[[2]]]}]];

GraphDiameter[g]

which gives 4.

Cheers, Marco

POSTED BY: Marco Thiel
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract