# Graphs

**URL:** https://discourse.julialang.org/c/domain/graphs/73.md?page=1

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 2

---

## [How do I store a data structure at the nodes of a graph from Graphs.jl?](https://discourse.julialang.org/t/how-do-i-store-a-data-structure-at-the-nodes-of-a-graph-from-graphs-jl/86774)

<div class="topic-metadata">

**Author:** [@cocoa1231](https://discourse.julialang.org/u/cocoa1231)\
**Replies:** 3\
**Last updated:** [May 14, 2023, 11:52am UTC](https://discourse.julialang.org/t/how-do-i-store-a-data-structure-at-the-nodes-of-a-graph-from-graphs-jl/86774 "2023-05-14T11:52:15Z")

</div>

Say I have a data structure with a “location” (ComplexF64) and a value (Float64) and I want to associate each node of a SimpleGraph from Graphs.jl to each node to keep track of connections between nodes. How should I go …

---

## [Making graph with shapefile](https://discourse.julialang.org/t/making-graph-with-shapefile/98768)

<div class="topic-metadata">

**Author:** [@Michelle\_Ko](https://discourse.julialang.org/u/Michelle_Ko)\
**Replies:** 3\
**Last updated:** [May 14, 2023, 8:17am UTC](https://discourse.julialang.org/t/making-graph-with-shapefile/98768 "2023-05-14T08:17:45Z")

</div>

Hi, I am new to Julia and need some help regarding construction of graph with shapefile. I have shapefile that contains polylines and want to get the shortest path using Dijkstra’s algorithm. The thing is, in order to …

---

## [How to find out the version of NetworkLayout.jl that worked for particular trees](https://discourse.julialang.org/t/how-to-find-out-the-version-of-networklayout-jl-that-worked-for-particular-trees/98438)

<div class="topic-metadata">

**Author:** [@empet](https://discourse.julialang.org/u/empet)\
**Replies:** 2\
**Last updated:** [May 7, 2023, 4:25pm UTC](https://discourse.julialang.org/t/how-to-find-out-the-version-of-networklayout-jl-that-worked-for-particular-trees/98438 "2023-05-07T16:25:37Z")

</div>

Late in september 2021, NetworkLayout.buchheim worked even with a non tree network. More precisely, it assigned coordinates to the nodes of an “almost” rooted tree, in the sense that a node could have two parents (exampl…

---

## [\[ANN\] GraphsExt, features for possible inclusion in Graphs.jl](https://discourse.julialang.org/t/ann-graphsext-features-for-possible-inclusion-in-graphs-jl/98170)

<div class="topic-metadata">

**Author:** [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)\
**Replies:** 5\
**Last updated:** [May 1, 2023, 6:33pm UTC](https://discourse.julialang.org/t/ann-graphsext-features-for-possible-inclusion-in-graphs-jl/98170 "2023-05-01T18:33:52Z")

</div>

GraphsExt.jl implements some things that may eventually be added to Graphs.jl. I need to use them and want to expose them before making PRs to Graphs.jl. This package is not registered in the general registry but is in a…

---

## [Simulating a dynamic satellite constellation network using SatelliteToolbox.jl](https://discourse.julialang.org/t/simulating-a-dynamic-satellite-constellation-network-using-satellitetoolbox-jl/97979)

<div class="topic-metadata">

**Author:** [@rafiulnakib](https://discourse.julialang.org/u/rafiulnakib)\
**Replies:** 1\
**Last updated:** [April 27, 2023, 6:20am UTC](https://discourse.julialang.org/t/simulating-a-dynamic-satellite-constellation-network-using-satellitetoolbox-jl/97979 "2023-04-27T06:20:43Z")

</div>

Hi everyone, I am trying to simulate a dynamic satellite constellation network using SatelliteToolbox. The goal is to use this network and integrate it with the QuNet package for benchmarking and performance analysis as…

---

## [Is there a allocation free graph package?](https://discourse.julialang.org/t/is-there-a-allocation-free-graph-package/97327)

<div class="topic-metadata">

**Author:** [@SteffenPL](https://discourse.julialang.org/u/SteffenPL)\
**Replies:** 8\
**Last updated:** [April 24, 2023, 7:07am UTC](https://discourse.julialang.org/t/is-there-a-allocation-free-graph-package/97327 "2023-04-24T07:07:28Z")

</div>

I’m dealing with graphs that have a maximal adjacency count. In that setting, it is possible to add, iterate and remove edges without allocations (see implementation below). That is important since I need to do these ope…

---

## [Graph.jl error in a\_star() function](https://discourse.julialang.org/t/graph-jl-error-in-a-star-function/96455)

<div class="topic-metadata">

**Author:** [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Replies:** 15\
**Last updated:** [April 3, 2023, 4:47pm UTC](https://discourse.julialang.org/t/graph-jl-error-in-a-star-function/96455 "2023-04-03T16:47:04Z")

</div>

I want to get shortest distance between two edges. using Graphs,GraphRecipes ,Plots,Karnak,NetworkLayout,Colors,SimpleWeightedGraphs begin G=SimpleWeightedGraph(5) add\_edge!(G, 1, 2,2000) add\_edge!(G, 1, 3,180…

---

## [How to read GraphML with node and vertex metadata](https://discourse.julialang.org/t/how-to-read-graphml-with-node-and-vertex-metadata/96770)

<div class="topic-metadata">

**Author:** [@ArtHarg](https://discourse.julialang.org/u/ArtHarg)\
**Replies:** 2\
**Last updated:** [March 29, 2023, 12:54pm UTC](https://discourse.julialang.org/t/how-to-read-graphml-with-node-and-vertex-metadata/96770 "2023-03-29T12:54:54Z")

</div>

Is there an efficient way to read a GraphML file and produce a MetaGraph? My use case: I have a file containing 210,157 vertices and 1,016,092 edges, all with metadata. I can succesfully read the graph using g = loadg…

---

## [Textbox graph with NetworkLayout with labels cut off using GraphMakie](https://discourse.julialang.org/t/textbox-graph-with-networklayout-with-labels-cut-off-using-graphmakie/96566)

<div class="topic-metadata">

**Author:** [@Nosferican](https://discourse.julialang.org/u/Nosferican)\
**Replies:** 3\
**Last updated:** [March 26, 2023, 7:02pm UTC](https://discourse.julialang.org/t/textbox-graph-with-networklayout-with-labels-cut-off-using-graphmakie/96566 "2023-03-26T19:02:38Z")

</div>

I am using a textbox graph with NetworkLayout. Using their layout algorithms it creates the positions based on the graph but when the labels are bigger than the points it cuts it of. What would be a good solution for com…

---

## [Animation of a GraphPlots in an Array](https://discourse.julialang.org/t/animation-of-a-graphplots-in-an-array/94793)

<div class="topic-metadata">

**Author:** [@flobe](https://discourse.julialang.org/u/flobe)\
**Replies:** 2\
**Last updated:** [March 3, 2023, 1:37pm UTC](https://discourse.julialang.org/t/animation-of-a-graphplots-in-an-array/94793 "2023-03-03T13:37:34Z")

</div>

Hi all, I have a big simulation loop resulting in a graphplot for each timestep. I store each of those plots in an array. Ultimately, I’d like to animate over all entries in this array. The minimal working example looks…

---

## [How to create a multigraph with weights?](https://discourse.julialang.org/t/how-to-create-a-multigraph-with-weights/77020)

<div class="topic-metadata">

**Author:** [@MILAJO](https://discourse.julialang.org/u/MILAJO)\
**Replies:** 5\
**Last updated:** [February 22, 2023, 2:40pm UTC](https://discourse.julialang.org/t/how-to-create-a-multigraph-with-weights/77020 "2023-02-22T14:40:00Z")

</div>

Hi. I have now been searching through multiple source codes within the different Julia graphs packages ( Graphs, MetaGraphs, SimpleWeightedGraphs) and also found the package called Multigraphs. However, I cannot seem to…

---

## [Graph.jl : How to interpret the output information returned by the shortest path algorithms?](https://discourse.julialang.org/t/graph-jl-how-to-interpret-the-output-information-returned-by-the-shortest-path-algorithms/94752)

<div class="topic-metadata">

**Author:** [@F\_A](https://discourse.julialang.org/u/F_A)\
**Replies:** 10\
**Last updated:** [February 17, 2023, 11:13am UTC](https://discourse.julialang.org/t/graph-jl-how-to-interpret-the-output-information-returned-by-the-shortest-path-algorithms/94752 "2023-02-17T11:13:23Z")

</div>

Hi there, I’d like to use Graph.jl package to run a shortest path algorithm. I have already read this page and am still not sure how to interpret the return traversal information of shortest path algorithm. Let’s assu…

---

## [Create graph from public Mastodon data](https://discourse.julialang.org/t/create-graph-from-public-mastodon-data/90637)

<div class="topic-metadata">

**Author:** [@mmeer](https://discourse.julialang.org/u/mmeer)\
**Replies:** 2\
**Last updated:** [February 8, 2023, 2:33pm UTC](https://discourse.julialang.org/t/create-graph-from-public-mastodon-data/90637 "2023-02-08T14:33:31Z")

</div>

Hi there, I have written a script to fetch an array of accounts that I follow on Mastodon. Each account is represented by a dictionary with KeySet for a Dict{String, Any} with 21 entries. Keys: "acct" "locked" "c…

---

## [Unable to use Types from Graphs.jl and GridGraphs.jl in Jupyter Notebook](https://discourse.julialang.org/t/unable-to-use-types-from-graphs-jl-and-gridgraphs-jl-in-jupyter-notebook/88913)

<div class="topic-metadata">

**Author:** [@MarawanEmara](https://discourse.julialang.org/u/MarawanEmara)\
**Replies:** 12\
**Last updated:** [November 19, 2022, 5:47pm UTC](https://discourse.julialang.org/t/unable-to-use-types-from-graphs-jl-and-gridgraphs-jl-in-jupyter-notebook/88913 "2022-11-19T17:47:03Z")

</div>

Hello. I am pretty new to Julia and attempting to replicate a tutorial for InferOpt.jl (Tutorial in question is linked here: Tutorial · InferOpt.jl). I have already installed the appropriate packages for using Julia in…

---

## [MetaGraphs.jl PR pending](https://discourse.julialang.org/t/metagraphs-jl-pr-pending/90101)

<div class="topic-metadata">

**Author:** [@filchristou](https://discourse.julialang.org/u/filchristou)\
**Replies:** 1\
**Last updated:** [November 15, 2022, 3:32pm UTC](https://discourse.julialang.org/t/metagraphs-jl-pr-pending/90101 "2022-11-15T15:32:43Z")

</div>

Could someone please have a look at my PR from March ? I am developing a side package that may be soon published and I wouldn’t want to have a dependency pointing to my fork… Sorry for bringing my request here. I’ve a…

---

## [How to build a network of networks graph (i.e. how to connect modules)?](https://discourse.julialang.org/t/how-to-build-a-network-of-networks-graph-i-e-how-to-connect-modules/88902)

<div class="topic-metadata">

**Author:** [@KalelR](https://discourse.julialang.org/u/KalelR)\
**Replies:** 3\
**Last updated:** [November 15, 2022, 3:30pm UTC](https://discourse.julialang.org/t/how-to-build-a-network-of-networks-graph-i-e-how-to-connect-modules/88902 "2022-11-15T15:30:08Z")

</div>

Hello I am new to using Graphs.jl and I would like to know a good way to build a graph for a network of networks. My specific application is to build a graph representing something like what is shown in the figure: 4…

---

## [Recommended packages for graph theory?](https://discourse.julialang.org/t/recommended-packages-for-graph-theory/89594)

<div class="topic-metadata">

**Author:** [@amca01](https://discourse.julialang.org/u/amca01)\
**Replies:** 4\
**Last updated:** [November 1, 2022, 10:03am UTC](https://discourse.julialang.org/t/recommended-packages-for-graph-theory/89594 "2022-11-01T10:03:21Z")

</div>

I’ve just started to explore graph theory in Julia. And there’s a bewildering array of packages. Some are unmaintained, such LightGraphs.jl and the old Graphs.jl. To confuse matters, LightGraphs.jl seems to be been fo…

---

## [How to fix? ArgumentError: row indices I\[k\] must satisfy 1 \<= I\[k\] \<= m](https://discourse.julialang.org/t/how-to-fix-argumenterror-row-indices-i-k-must-satisfy-1-i-k-m/88931)

<div class="topic-metadata">

**Author:** [@F\_A](https://discourse.julialang.org/u/F_A)\
**Replies:** 2\
**Last updated:** [October 18, 2022, 8:18pm UTC](https://discourse.julialang.org/t/how-to-fix-argumenterror-row-indices-i-k-must-satisfy-1-i-k-m/88931 "2022-10-18T20:18:57Z")

</div>

Hi, I’ve already ask this here. But, perhaps asking here is better. When I try to build a graph from the following arrays of sources, destinations, and weights, the last line returns an error ERROR: ArgumentError: col…

---

## [Creating a Weighted Graph](https://discourse.julialang.org/t/creating-a-weighted-graph/41241)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 33\
**Last updated:** [June 16, 2020, 9:50pm UTC](https://discourse.julialang.org/t/creating-a-weighted-graph/41241 "2020-06-16T21:50:46Z")

</div>

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.0…

---

## [Undirected to directed graph](https://discourse.julialang.org/t/undirected-to-directed-graph/88491)

<div class="topic-metadata">

**Author:** [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Replies:** 2\
**Last updated:** [October 9, 2022, 5:14pm UTC](https://discourse.julialang.org/t/undirected-to-directed-graph/88491 "2022-10-09T17:14:10Z")

</div>

I have an undirected graph. Is there a simple function or similar for converting it to a directed graph (where each edge is replaced by two edges, one in each direction)?

---

## [Edgelist representation as array](https://discourse.julialang.org/t/edgelist-representation-as-array/49960)

<div class="topic-metadata">

**Author:** [@SDA](https://discourse.julialang.org/u/SDA)\
**Replies:** 1\
**Last updated:** [September 27, 2022, 11:39am UTC](https://discourse.julialang.org/t/edgelist-representation-as-array/49960 "2022-09-27T11:39:15Z")

</div>

I am wanting to get an edgelist from my graph that can then be used as a coordinate in 2D. using LightGraphs A = \[ 0 1 1 1 0 1 1 1 0 \] G = Graph(A) EL = collect(edges(G)) How can the edge list EL be converted to an ar…

---

## [(Directed acyclic) graphs with non-integer data type](https://discourse.julialang.org/t/directed-acyclic-graphs-with-non-integer-data-type/87744)

<div class="topic-metadata">

**Author:** [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Replies:** 3\
**Last updated:** [September 24, 2022, 9:58pm UTC](https://discourse.julialang.org/t/directed-acyclic-graphs-with-non-integer-data-type/87744 "2022-09-24T21:58:09Z")

</div>

Is there a Julia package that I can use for defining a directed acyclic graph with non-integer vertices? I looked around at Graphs.jl, but it seems that I’m restricted to integer indices there. The main indices I do want…

---

## [How to draw a directed graph of transition matrix](https://discourse.julialang.org/t/how-to-draw-a-directed-graph-of-transition-matrix/87399)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 2\
**Last updated:** [September 18, 2022, 9:59am UTC](https://discourse.julialang.org/t/how-to-draw-a-directed-graph-of-transition-matrix/87399 "2022-09-18T09:59:41Z")

</div>

Hi all, I would like to draw a network to visualize a transition matrix. I was wondering if there is a package somewhere that automatically generates a directed graph from a transition matrix. Here is an example of what…

---

## [How to have condition on SimpleWeightedDiGraph function?](https://discourse.julialang.org/t/how-to-have-condition-on-simpleweighteddigraph-function/86735)

<div class="topic-metadata">

**Author:** [@A\_Green\_Leave](https://discourse.julialang.org/u/A_Green_Leave)\
**Replies:** 7\
**Last updated:** [September 5, 2022, 7:43pm UTC](https://discourse.julialang.org/t/how-to-have-condition-on-simpleweighteddigraph-function/86735 "2022-09-05T19:43:10Z")

</div>

Hi Guys According to the documentation the way SimpleWeightedDiGraph works is something like a g = SimpleWeightedDiGraph(heads, tails, weights). If so and if having a three list of requirements: heads = \[ 62, 17, 15, 2…

---

## [How to select a subgraph in Graph.jl Package](https://discourse.julialang.org/t/how-to-select-a-subgraph-in-graph-jl-package/86631)

<div class="topic-metadata">

**Author:** [@A\_Green\_Leave](https://discourse.julialang.org/u/A_Green_Leave)\
**Replies:** 1\
**Last updated:** [September 1, 2022, 8:50am UTC](https://discourse.julialang.org/t/how-to-select-a-subgraph-in-graph-jl-package/86631 "2022-09-01T08:50:29Z")

</div>

Hi, I’m working with Graph and SimpleWeightedGraphs Packages and was wondering if they allow to extract/select a subgraph and work with it too? I mean having a subgraph knowing its edges and nodes. I’d like to work w…

---

## [Find cycles in a direct graph (simplecycles error: function not defined)](https://discourse.julialang.org/t/find-cycles-in-a-direct-graph-simplecycles-error-function-not-defined/86449)

<div class="topic-metadata">

**Author:** [@Luiz\_Monteiro](https://discourse.julialang.org/u/Luiz_Monteiro)\
**Replies:** 3\
**Last updated:** [August 28, 2022, 12:15pm UTC](https://discourse.julialang.org/t/find-cycles-in-a-direct-graph-simplecycles-error-function-not-defined/86449 "2022-08-28T12:15:18Z")

</div>

Hi, I need to find cycles in a direct graph and return the vector of nodes of each cycle. I am using Graphs, LightGraphs, SimpleWeightedGraphs. Example: For a direct graph with the arcs \[(1 3), (2 4), (3 1), (4 5), (5, …

---

## [Accessing edges in non-sorted fashion Graphs.jl?](https://discourse.julialang.org/t/accessing-edges-in-non-sorted-fashion-graphs-jl/70261)

<div class="topic-metadata">

**Author:** [@yewalenikhil65](https://discourse.julialang.org/u/yewalenikhil65)\
**Replies:** 4\
**Last updated:** [August 25, 2022, 9:12am UTC](https://discourse.julialang.org/t/accessing-edges-in-non-sorted-fashion-graphs-jl/70261 "2022-08-25T09:12:40Z")

</div>

g = DiGraph(3); add\_edge!(g, 2, 1) add\_edge!(g, 1, 2) add\_edge!(g, 3, 2) julia\> collect(edges(g)) 3-element Vector{LightGraphs.SimpleGraphs.SimpleEdge{Int64}}: Edge 1 =\> 2 Edge 2 =\> 1 Edge 3 =\> 2 edges collected he…

---

## [What is the optimised way to find connected components in a graph with edge weights greater than zero?](https://discourse.julialang.org/t/what-is-the-optimised-way-to-find-connected-components-in-a-graph-with-edge-weights-greater-than-zero/85902)

<div class="topic-metadata">

**Author:** [@Manu\_Francis](https://discourse.julialang.org/u/Manu_Francis)\
**Replies:** 4\
**Last updated:** [August 18, 2022, 5:37am UTC](https://discourse.julialang.org/t/what-is-the-optimised-way-to-find-connected-components-in-a-graph-with-edge-weights-greater-than-zero/85902 "2022-08-18T05:37:16Z")

</div>

Hi I am trying to find the connected components of a simple weighted graph with edge weights having a value greater than zero as below. using Graphs using SimpleWeightedGraphs len = 105\_000 g = SimpleWeighted…

---

## [How to add metadata such as labels to nodes in Graphs.jl?](https://discourse.julialang.org/t/how-to-add-metadata-such-as-labels-to-nodes-in-graphs-jl/84513)

<div class="topic-metadata">

**Author:** [@tiZ](https://discourse.julialang.org/u/tiZ)\
**Replies:** 4\
**Last updated:** [July 20, 2022, 12:21pm UTC](https://discourse.julialang.org/t/how-to-add-metadata-such-as-labels-to-nodes-in-graphs-jl/84513 "2022-07-20T12:21:42Z")

</div>

Hi, I wonder if there some convenient way to add the labels to nodes in a graph, I’m using Graphs.jl currently. I have try to record the (node Number =\> label) in a separated dictionary, but I think the order of node…

---

## [Weighted graph using SparseCSC julia](https://discourse.julialang.org/t/weighted-graph-using-sparsecsc-julia/84071)

<div class="topic-metadata">

**Author:** [@ayodyas](https://discourse.julialang.org/u/ayodyas)\
**Replies:** 8\
**Last updated:** [July 19, 2022, 7:31am UTC](https://discourse.julialang.org/t/weighted-graph-using-sparsecsc-julia/84071 "2022-07-19T07:31:43Z")

</div>

I am new to julia and was trying to do weighted graph partition using metis in Julia. I coudnt undertstand how the SparseCSc for graph creation with edge and vertex weight as required for format of the metis (graph parti…

[Previous page](https://discourse.julialang.org/c/domain/graphs/73.md)

[Next page](https://discourse.julialang.org/c/domain/graphs/73.md?page=2)
