# Graphs

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

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

**Page:** 3

---

## [Outputting all Cycles in an undirected graph using DFS](https://discourse.julialang.org/t/outputting-all-cycles-in-an-undirected-graph-using-dfs/84222)

<div class="topic-metadata">

**Author:** [@Temi-Tory](https://discourse.julialang.org/u/Temi-Tory)\
**Replies:** 6\
**Last updated:** [July 15, 2022, 11:04am UTC](https://discourse.julialang.org/t/outputting-all-cycles-in-an-undirected-graph-using-dfs/84222 "2022-07-15T11:04:38Z")

</div>

Hi Guys, I’m hoping someone can help me figure out why my function is not working as expected. Any help is appreciated. I was going through this geek-for-geek post on how to detect and print cycles in an undircetd gr…

---

## [Custom graph typing question (Graphs.jl)](https://discourse.julialang.org/t/custom-graph-typing-question-graphs-jl/84191)

<div class="topic-metadata">

**Author:** [@RobertGregg](https://discourse.julialang.org/u/RobertGregg)\
**Replies:** 2\
**Last updated:** [July 14, 2022, 4:31pm UTC](https://discourse.julialang.org/t/custom-graph-typing-question-graphs-jl/84191 "2022-07-14T16:31:32Z")

</div>

I’ve defined a new graph type which is a subtype of Graphs.AbstractSimpleGraph to represent a grid-like structure: using Graphs mutable struct GridSpace{N, T\<:Integer} \<: Graphs.AbstractSimpleGraph{T} ne::T …

---

## [Performance of weighed graphs](https://discourse.julialang.org/t/performance-of-weighed-graphs/83661)

<div class="topic-metadata">

**Author:** [@Jirka\_Fink](https://discourse.julialang.org/u/Jirka_Fink)\
**Replies:** 9\
**Last updated:** [July 12, 2022, 9:02am UTC](https://discourse.julialang.org/t/performance-of-weighed-graphs/83661 "2022-07-12T09:02:38Z")

</div>

I work on combinarotial optimization, so I am looking data structures storing weighed graph. At https://juliagraphs.org/, I found SimpleWeightedGraphs, MetaGraphs, MetaGraphsNext. However, neither of them seems to me t…

---

## [LightGraphs.jl Transition](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526)

<div class="topic-metadata">

**Author:** [@jpfairbanks](https://discourse.julialang.org/u/jpfairbanks)\
**Replies:** 73\
**Last updated:** [July 4, 2022, 12:20pm UTC](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526 "2022-07-04T12:20:39Z")

</div>

Since Jan 21, 2015 @sbromberger has been leading the LightGraphs development to build a correct, flexible, and performant graph analytics toolkit. I joined the project on March 3, 2015 when I needed to isolate the maxima…

---

## [Plotting a weighted tree graph](https://discourse.julialang.org/t/plotting-a-weighted-tree-graph/82637)

<div class="topic-metadata">

**Author:** [@devanshu](https://discourse.julialang.org/u/devanshu)\
**Replies:** 14\
**Last updated:** [June 16, 2022, 5:31am UTC](https://discourse.julialang.org/t/plotting-a-weighted-tree-graph/82637 "2022-06-16T05:31:14Z")

</div>

I am trying to plot a weighted graph using SimpleWeightedGraphs using GraphPlot. g = SimpleWeightedGraph(5) add\_edge!(g, 1, 2, 0.5) add\_edge!(g, 1, 3, 2.0) add\_edge!(g, 1, 4, 3.5) add\_edge!(g, 1, 5, 5.0) gplot(g) Bu…

---

## [Graph vertex and edge attributes](https://discourse.julialang.org/t/graph-vertex-and-edge-attributes/82234)

<div class="topic-metadata">

**Author:** [@CopyOfA](https://discourse.julialang.org/u/CopyOfA)\
**Replies:** 4\
**Last updated:** [June 4, 2022, 7:06pm UTC](https://discourse.julialang.org/t/graph-vertex-and-edge-attributes/82234 "2022-06-04T19:06:29Z")

</div>

I am a newbie to graph analytics in Julia and I am using Graphs.jl for graph analysis. In other libraries (e.g., R’s igraph or Python’s networkx) there is the ability to add attributes to the edges and vertices. However,…

---

## [How to extract weights from SimpleWeightedEdge (from kruskal\_mst)](https://discourse.julialang.org/t/how-to-extract-weights-from-simpleweightededge-from-kruskal-mst/81192)

<div class="topic-metadata">

**Author:** [@JedPhillips](https://discourse.julialang.org/u/JedPhillips)\
**Replies:** 5\
**Last updated:** [May 18, 2022, 7:19am UTC](https://discourse.julialang.org/t/how-to-extract-weights-from-simpleweightededge-from-kruskal-mst/81192 "2022-05-18T07:19:34Z")

</div>

I’m trying to figure out how to interact with a minimal spanning tree object returned by Graphs.kruskal\_mst(). I just can’t figure out how to extract the resulting edge wights (or the edges). Here’s a minimal code to sh…

---

## [Detect and Return Cycles in a given directed graph](https://discourse.julialang.org/t/detect-and-return-cycles-in-a-given-directed-graph/80493)

<div class="topic-metadata">

**Author:** [@Temi-Tory](https://discourse.julialang.org/u/Temi-Tory)\
**Replies:** 20\
**Last updated:** [May 9, 2022, 9:20am UTC](https://discourse.julialang.org/t/detect-and-return-cycles-in-a-given-directed-graph/80493 "2022-05-09T09:20:17Z")

</div>

Hi there, I was wondering if there was a way to detect the number of cycles in a graph. And for each cycle detected, i want to know which nodes are involved in the cycle. I have attached an example of the simplest form…

---

## [Why do I keep getting a Method Error for Graphs package every time?](https://discourse.julialang.org/t/why-do-i-keep-getting-a-method-error-for-graphs-package-every-time/80004)

<div class="topic-metadata">

**Author:** [@Temi-Tory](https://discourse.julialang.org/u/Temi-Tory)\
**Replies:** 6\
**Last updated:** [April 25, 2022, 8:28pm UTC](https://discourse.julialang.org/t/why-do-i-keep-getting-a-method-error-for-graphs-package-every-time/80004 "2022-04-25T20:28:23Z")

</div>

Hello there, I am having a seemingly recurring issue here. Lets say I am working on a Julia file with graphs for a while and everything is going well. Then I close that file and don’t use it for ages, and then the next…

---

## [Custom array (a variations on adjacency matrix for graphs)](https://discourse.julialang.org/t/custom-array-a-variations-on-adjacency-matrix-for-graphs/79196)

<div class="topic-metadata">

**Author:** [@AlexanderChen](https://discourse.julialang.org/u/AlexanderChen)\
**Replies:** 2\
**Last updated:** [April 8, 2022, 6:18am UTC](https://discourse.julialang.org/t/custom-array-a-variations-on-adjacency-matrix-for-graphs/79196 "2022-04-08T06:18:03Z")

</div>

Hi, So I am doing a project in which i need to heavily use a graph structure. I have tried several graph package in the past, but they are not flexible enough for my use case. So I started to wonder if the following is …

---

## [Indirect Connected vertices in a digraph](https://discourse.julialang.org/t/indirect-connected-vertices-in-a-digraph/77631)

<div class="topic-metadata">

**Author:** [@Temi-Tory](https://discourse.julialang.org/u/Temi-Tory)\
**Replies:** 5\
**Last updated:** [March 9, 2022, 2:53pm UTC](https://discourse.julialang.org/t/indirect-connected-vertices-in-a-digraph/77631 "2022-03-09T14:53:58Z")

</div>

Hi guys, This may be an obvious or silly question but I cannot seem to figure out how to do so. I’m not sure how to do this especially for graphs with large number of vertices, where I want to check if there is a path …

---

## [Issues with Graphs.jl and GraphPlot](https://discourse.julialang.org/t/issues-with-graphs-jl-and-graphplot/76932)

<div class="topic-metadata">

**Author:** [@Temi-Tory](https://discourse.julialang.org/u/Temi-Tory)\
**Replies:** 1\
**Last updated:** [February 25, 2022, 5:57pm UTC](https://discourse.julialang.org/t/issues-with-graphs-jl-and-graphplot/76932 "2022-02-25T17:57:18Z")

</div>

Hello, I am not sure what is causing the following error message and I have been stuck for hours now :frowning: please help. For some reason, gplot is not working. My code: import Cairo,Fontconfig using Random, Gra…

---

## [Delete multiple edges with specific property in a metagraph](https://discourse.julialang.org/t/delete-multiple-edges-with-specific-property-in-a-metagraph/76745)

<div class="topic-metadata">

**Author:** [@ChristianStehr](https://discourse.julialang.org/u/ChristianStehr)\
**Replies:** 8\
**Last updated:** [February 19, 2022, 2:53pm UTC](https://discourse.julialang.org/t/delete-multiple-edges-with-specific-property-in-a-metagraph/76745 "2022-02-19T14:53:34Z")

</div>

Hello everyone, I want to delete multiple edges in a metagraph that have a specific property, here is my mwe: using MetaGraphs, Graphs g = erdos\_renyi(1000,5000) mg = MetaGraph(g) for i in 1:nv(mg) #give all edges spec…

---

## [Creating a graph with objects or structs as nodes](https://discourse.julialang.org/t/creating-a-graph-with-objects-or-structs-as-nodes/76088)

<div class="topic-metadata">

**Author:** [@flobe](https://discourse.julialang.org/u/flobe)\
**Replies:** 3\
**Last updated:** [February 10, 2022, 10:54am UTC](https://discourse.julialang.org/t/creating-a-graph-with-objects-or-structs-as-nodes/76088 "2022-02-10T10:54:36Z")

</div>

Hi everyone, I would like to create a graph where the nodes can contain multiple pieces of information. I tried to use graph.jl, but currently I don’t see any way to store more information than the child nodes. For exa…

---

## [Counting Graphlets or Motifs](https://discourse.julialang.org/t/counting-graphlets-or-motifs/74580)

<div class="topic-metadata">

**Author:** [@Rasoul](https://discourse.julialang.org/u/Rasoul)\
**Replies:** 2\
**Last updated:** [January 17, 2022, 1:00am UTC](https://discourse.julialang.org/t/counting-graphlets-or-motifs/74580 "2022-01-17T01:00:22Z")

</div>

Hello everybody, I will appreciate it if you let me know about the existence of a Julia package for counting graphlets or motifs in a graph. All the best, Rasoul

---

## [Plotting graph using edge list](https://discourse.julialang.org/t/plotting-graph-using-edge-list/74541)

<div class="topic-metadata">

**Author:** [@Jeffrey](https://discourse.julialang.org/u/Jeffrey)\
**Replies:** 1\
**Last updated:** [January 13, 2022, 11:57am UTC](https://discourse.julialang.org/t/plotting-graph-using-edge-list/74541 "2022-01-13T11:57:09Z")

</div>

Hi all. I want to plot a SimpleDiGraph using an edge list and label the edges according to their position in my edge list. For example, if I run the following code using Graphs, GraphPlot edge\_list = Edge.(\[ (1, 3), (3…

---

## [LightGraphs.jl/Graphs.jl only values from half the cartesian plane is needed](https://discourse.julialang.org/t/lightgraphs-jl-graphs-jl-only-values-from-half-the-cartesian-plane-is-needed/74080)

<div class="topic-metadata">

**Author:** [@HelgavonLichtenstein](https://discourse.julialang.org/u/HelgavonLichtenstein)\
**Replies:** 3\
**Last updated:** [January 5, 2022, 1:34pm UTC](https://discourse.julialang.org/t/lightgraphs-jl-graphs-jl-only-values-from-half-the-cartesian-plane-is-needed/74080 "2022-01-05T13:34:50Z")

</div>

Hi, this is a continuation of finding link distances between species in a food web. It’s been a few months so I am starting a new topic. I can find distances between species, but when I want to randomly choose a species …

---

## [Is there a lazy version of graph?](https://discourse.julialang.org/t/is-there-a-lazy-version-of-graph/73119)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 7\
**Last updated:** [December 16, 2021, 3:55pm UTC](https://discourse.julialang.org/t/is-there-a-lazy-version-of-graph/73119 "2021-12-16T15:55:06Z")

</div>

I came across an interesting problem recently that can be solved with the shortest path algorithms from Graphs.jl. The only problem is that it takes a “long time” (julia scale :slight\_smile: ) to build the graph because …

---

## [Citing error in bib file for Graph jl](https://discourse.julialang.org/t/citing-error-in-bib-file-for-graph-jl/72701)

<div class="topic-metadata">

**Author:** [@yusri-dh](https://discourse.julialang.org/u/yusri-dh)\
**Replies:** 2\
**Last updated:** [December 8, 2021, 1:55am UTC](https://discourse.julialang.org/t/citing-error-in-bib-file-for-graph-jl/72701 "2021-12-08T01:55:05Z")

</div>

I am trying to cite Graphs jl in paper using the citation bib inside the github page: @misc{Graphs2021, author = {James Fairbanks, Mathieu Besançon, Simon Schölly, Júlio Hoffiman, Nick Eubank, and Stefan Karpin…

---

## [Construct multiple graphs from sparse adjacency matrix](https://discourse.julialang.org/t/construct-multiple-graphs-from-sparse-adjacency-matrix/72256)

<div class="topic-metadata">

**Author:** [@markmbaum](https://discourse.julialang.org/u/markmbaum)\
**Replies:** 4\
**Last updated:** [November 29, 2021, 8:38pm UTC](https://discourse.julialang.org/t/construct-multiple-graphs-from-sparse-adjacency-matrix/72256 "2021-11-29T20:38:26Z")

</div>

I have a sparse adjacency matrix (SparseMatrixCSC) representing connections between the elements of a collection. I see that I can neatly convert it to a graph with the Graph constructor from Graphs.jl. However, I know …

---

## [Giant components of graph](https://discourse.julialang.org/t/giant-components-of-graph/71361)

<div class="topic-metadata">

**Author:** [@yusri-dh](https://discourse.julialang.org/u/yusri-dh)\
**Replies:** 2\
**Last updated:** [November 14, 2021, 12:08am UTC](https://discourse.julialang.org/t/giant-components-of-graph/71361 "2021-11-14T00:08:15Z")

</div>

Dear all, Is there any function to get a subset of graph that have largest connected component using Graphs.jl (version \>= 1.4.1)? I only found function connected\_components that return a list of connected vertices? I…

---

## [Retworkx: new, high-performance Python graph library](https://discourse.julialang.org/t/retworkx-new-high-performance-python-graph-library/71109)

<div class="topic-metadata">

**Author:** [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)\
**Replies:** 14\
**Last updated:** [November 13, 2021, 4:51am UTC](https://discourse.julialang.org/t/retworkx-new-high-performance-python-graph-library/71109 "2021-11-13T04:51:34Z")

</div>

retworkx is a python library wrapping the petgraph Rust library. (Actually, retworkx itself has a pure-Rust layer enhancing petgraph). retworkx is a strong contender for Most Performant Python Graph Library. Development…

---

## [Find all Hamiltonian cycles using Graphs.jl](https://discourse.julialang.org/t/find-all-hamiltonian-cycles-using-graphs-jl/71304)

<div class="topic-metadata">

**Author:** [@mdtisdall](https://discourse.julialang.org/u/mdtisdall)\
**Replies:** 3\
**Last updated:** [November 11, 2021, 3:42pm UTC](https://discourse.julialang.org/t/find-all-hamiltonian-cycles-using-graphs-jl/71304 "2021-11-11T15:42:20Z")

</div>

I’m wondering if there’s an existing implementation of an algorithm to find all Hamiltonian cycles within an unweighted, undirected graph. The graphs I’m interested in are small, on the order of 20 vertices. Basically I’…

---

## [Graph from Sparse Matrix](https://discourse.julialang.org/t/graph-from-sparse-matrix/70894)

<div class="topic-metadata">

**Author:** [@rachithaiyappa](https://discourse.julialang.org/u/rachithaiyappa)\
**Replies:** 2\
**Last updated:** [November 3, 2021, 6:39pm UTC](https://discourse.julialang.org/t/graph-from-sparse-matrix/70894 "2021-11-03T18:39:11Z")

</div>

How can I generate a Graph from a SparseMatrixCSC and then convert it into an undirected Light Graph?

---

## [How to remove the vertex in Graphs or LightGraphs?](https://discourse.julialang.org/t/how-to-remove-the-vertex-in-graphs-or-lightgraphs/70789)

<div class="topic-metadata">

**Author:** [@yewalenikhil65](https://discourse.julialang.org/u/yewalenikhil65)\
**Replies:** 3\
**Last updated:** [November 2, 2021, 10:13am UTC](https://discourse.julialang.org/t/how-to-remove-the-vertex-in-graphs-or-lightgraphs/70789 "2021-11-02T10:13:13Z")

</div>

julia\> myedges = \[ 1 =\> 2, 1 =\> 3, 2 =\> 1, 2 =\> 3, 3 =\> 1, 3 =\> 2, 3 =\> 4, 4 =\> 3, 4 =\> 8, 4 =\> 13, 5 =\> 6, 6 =\> 5, 7 =\> 8,…

---

## [LightGraphs docs not accessible?](https://discourse.julialang.org/t/lightgraphs-docs-not-accessible/69474)

<div class="topic-metadata">

**Author:** [@yewalenikhil65](https://discourse.julialang.org/u/yewalenikhil65)\
**Replies:** 7\
**Last updated:** [October 26, 2021, 1:21am UTC](https://discourse.julialang.org/t/lightgraphs-docs-not-accessible/69474 "2021-10-26T01:21:25Z")

</div>

https://juliagraphs.org/LightGraphs.jl/latest/ the docs page give 404 error… Any idea whats the issue ?

---

## [How group nodes if a path exists between nodes?](https://discourse.julialang.org/t/how-group-nodes-if-a-path-exists-between-nodes/70127)

<div class="topic-metadata">

**Author:** [@Manu\_Francis](https://discourse.julialang.org/u/Manu_Francis)\
**Replies:** 1\
**Last updated:** [October 21, 2021, 8:15am UTC](https://discourse.julialang.org/t/how-group-nodes-if-a-path-exists-between-nodes/70127 "2021-10-21T08:15:55Z")

</div>

Hi, If I have some nodes coordinates and I have to group these nodes together if there is path exist between them. Is there any algorithm available? The graph structure looks like below: # Load the packages using Ligh…

---

## [Using LightGraphs to study ODEproblems](https://discourse.julialang.org/t/using-lightgraphs-to-study-odeproblems/69545)

<div class="topic-metadata">

**Author:** [@Frazze](https://discourse.julialang.org/u/Frazze)\
**Replies:** 3\
**Last updated:** [October 14, 2021, 10:41am UTC](https://discourse.julialang.org/t/using-lightgraphs-to-study-odeproblems/69545 "2021-10-14T10:41:33Z")

</div>

Hi everyone, I’m studying an ODEProblem where the function have a laplacian operator. #Domain and grid Nx = 40 Ny = 40 lx = 12 ly = 12 # the Laplacian operator function Laplacian2D(Nx, Ny, lx, ly) hx = lx/Nx hy = l…

---

## [GraphRecipes graphplot discrepancy nodeshape and nodecolor](https://discourse.julialang.org/t/graphrecipes-graphplot-discrepancy-nodeshape-and-nodecolor/69549)

<div class="topic-metadata">

**Author:** [@moesphere](https://discourse.julialang.org/u/moesphere)\
**Replies:** 0\
**Last updated:** [October 11, 2021, 9:09am UTC](https://discourse.julialang.org/t/graphrecipes-graphplot-discrepancy-nodeshape-and-nodecolor/69549 "2021-10-11T09:09:07Z")

</div>

The following MWE gives incorrect colours for specified node shapes: using GraphRecipes using Plots M = \[0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 …

---

## [Traversing a directional graph](https://discourse.julialang.org/t/traversing-a-directional-graph/69470)

<div class="topic-metadata">

**Author:** [@yewalenikhil65](https://discourse.julialang.org/u/yewalenikhil65)\
**Replies:** 0\
**Last updated:** [October 9, 2021, 10:50am UTC](https://discourse.julialang.org/t/traversing-a-directional-graph/69470 "2021-10-09T10:50:11Z")

</div>

How to traverse a directional graph in LightGraphs package in a unidirectional sense? Meaning I do want to omit the reverse edges if any in the DiGraph !

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

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