Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

Creating a Weighted Graph

$
0
0

I would like to try using a weighted graph. To this end, I added SimpleWeightedGraphs to Atom, created an erdos_renyi directed graph, and then applied SimpleWeightedGraphs to this graph.

const G = erdos_renyi(10000, 0.0012, is_directed=true)
WG = SimpleWeightedGraph(G)

I would now like to add weights to selected edges. What is the easiest approach to doing that. I know how to construct the graph from scratch, one edge at a time. But let us say that I wanted the first half of the edges to have weight=2, and the second half to have weight=3. What would be the best approach to accomplish this? Thanks!

15 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 2795

Latest Images

Trending Articles



Latest Images