Message Boards Message Boards

How do I add vertex weights?

Posted 11 years ago

This is an extension of a previous question that I asked on this forum. I have an excel file of vertex weights in the first column and their corresponding vertices in the second. The graph comes out as planned, but it is not a weighted graph, as I would expect from the following code:

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

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

How do I assign vertex weights? Any response is appreciated.

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

The kernel was evaluating locally. I changed it to global, and now the problem is resolved. Thank you for all of your help!

POSTED BY: Shawn Doyle

That is strange. I cannot reproduce your problem.

If you want to upload files to the cloud there is a button for that:

enter image description here

On the top right there is a button that says "New"; to the right of that you have "an arrow that points up/into the sky/cloud". You can upload files using that.

Cheers,

Marco

POSTED BY: Marco Thiel
Posted 11 years ago

I'm running Mathematica 9.0, and I am not sure how to import the data into Wolfram Cloud. I've quit the kernel and started again, to no avail.

POSTED BY: Shawn Doyle

That is very strange. I tried different machines and different versions of Mathematica. I always get True.

enter image description here

Have you tried restarting the kernel/Mathematica?Which version of Mathematica are you running? You should have access to the Wolfram Cloud. Can you try running your code there?

M.

POSTED BY: Marco Thiel
Posted 11 years ago
POSTED BY: Shawn Doyle
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