Skip to main content

Questions tagged [graphs-and-networks]

Questions about handling graphs in Mathematica, graph theory, graph visualization, GraphPlot, the built-in Graph type and the Combinatorica` package.

Filter by
Sorted by
Tagged with
0 votes
0 answers
57 views

Version: "14.3.0 for Linux x86 (64-bit) (July 8, 2025)" The code listed below using the data following it produces the result shown in the image. I want the node labels positioned directly ...
Steven Thomas Hatton's user avatar
1 vote
1 answer
80 views

How can I check whether two edges (tagged "c" and "d") have consistent orientation (either always the same ...
internet's user avatar
  • 1,417
4 votes
1 answer
127 views

Is there any efficient way to find cycle matroid of a graph? A cycle matroid is basically all sets of edges in a graph that does not form a cycle. The code below works pretty well for small graphs, ...
internet's user avatar
  • 1,417
2 votes
1 answer
112 views

The following is a minimal example where it seems that 13.3 is unable to display labels over edges. How to fix that? ...
florin's user avatar
  • 2,380
3 votes
1 answer
80 views

Given a list of directed edge-tagged graphs gList like this: ...
internet's user avatar
  • 1,417
1 vote
2 answers
139 views

I have a large DAG that I'm trying to visualise. It's the history of a large (~350k+ commits) git repository with multiple separate origin points. I've tried using a handful of different graph layout ...
OneDeuxTriSeiGo's user avatar
1 vote
0 answers
78 views

VertexContract works with EdgeTaggedGraphs: ...
user46831's user avatar
  • 701
4 votes
2 answers
183 views

Assume that I have a list of simple cycle EdgeTaggedGraph objects called fundamentalCycles. I would like to construct a graph <...
internet's user avatar
  • 1,417
3 votes
1 answer
125 views

Switching between {1, 5} and {5, 1} has no effect on produced graphs even though EdgeList-s ...
azerbajdzan's user avatar
  • 32.8k
3 votes
3 answers
237 views

Suppose I have a graph (undirected): ...
EstabanW's user avatar
  • 872
0 votes
1 answer
135 views

Let $G$ be a graph of order $n$. Then the visibility polynomial, $\mathcal{V}(G)$, of $G$ is defined as $$ \\ \mathcal{V}(G)=\sum_{i\geq 0} r_i x^{i} \\ $$ where $r_i$ denote the number of mutual-...
138 Aspen's user avatar
  • 2,354
6 votes
2 answers
304 views

How can I find all simple cycles of a multigraph with edge tags in Mathematica? I tried the following, but it does not work as expected. It only returns fundamental cycles instead of all possible ...
internet's user avatar
  • 1,417
0 votes
0 answers
76 views

I like to reproduce the algorithm(s) provided in https://arxiv.org/abs/1709.08561 to solve the all-terminal network reliability problem: Given an undirected connected graph $G$, suppose each edge is ...
138 Aspen's user avatar
  • 2,354
4 votes
0 answers
118 views

Why HighlightGraph highlights undirected tagged edges only if order of vertices agrees? Two edges should be red but we have only one. Tested on version 13.0.1 and ...
azerbajdzan's user avatar
  • 32.8k
2 votes
1 answer
104 views

I have the following directed graph and a cutset: ...
internet's user avatar
  • 1,417
1 vote
0 answers
108 views

A DeBruijnSequence of order $n$ on a list of length $k$ is a cyclic sequence of length in which every possible block of length $n$ taken from the list occurs ...
138 Aspen's user avatar
  • 2,354
0 votes
0 answers
36 views

I have an expression that is a sum of graph terms. Each term is a pair {graph, coeff}, where graph is a list of edges. A single <...
Ceasar's user avatar
  • 101
4 votes
1 answer
118 views

UndirectedGraph[g] gives an undirected graph from the directed graph g. The document says that ...
A. Kato's user avatar
  • 8,645
5 votes
3 answers
275 views

I am trying to find the fundamental cycles of a directed graph in Mathematica. I defined my graph as follows: ...
internet's user avatar
  • 1,417
6 votes
2 answers
377 views

I have just discovered that it is possible to manipulate vertices or edges of graphs if they are converted to Graphics. After manipulation you can extract position ...
azerbajdzan's user avatar
  • 32.8k
2 votes
2 answers
207 views

What can be done when GraphLayout -> "TutteEmbedding" produces ugly graphs? ...
azerbajdzan's user avatar
  • 32.8k
2 votes
1 answer
119 views

Suppose I have an undirected weighted graph (example) ...
user2757771's user avatar
5 votes
1 answer
103 views

GraphLayout can do a lot of cool things like when we set the option to SpringElectricalEmbedding and other embeddings for ...
Romogi's user avatar
  • 687
4 votes
2 answers
268 views

My goal is to capture the results of brainstorming session in a graph where, for the high-level process, the vertices look like text boxes and are connected by directed edges. I succeeded in the first ...
Tom Barson's user avatar
2 votes
3 answers
370 views

When I import a DOT file (or a string in that format) with labels containing the exact characters \\l or \\r, they are displayed ...
Mark S.'s user avatar
  • 1,143
2 votes
0 answers
125 views

I decided to test Colin de Verdière's graph invariant method and use it to estimate the planarity of a graph. The materials I used: https://en.wikipedia.org/wiki/Colin_de_Verdi%C3%A8re_graph_invariant ...
ayr's user avatar
  • 2,665
3 votes
2 answers
155 views

I want to find all cutsets of a graph based on the following definition: A cutset is a set of edges of a connected graph G such that the removal of these edges from G reduces the rank of G by one, ...
emnha's user avatar
  • 2,151
1 vote
0 answers
81 views

A topological index, also known as a connectivity index, is a type of a molecular descriptor that is calculated based on the molecular graph of a chemical compound How to refine below code (...
Ahamad's user avatar
  • 1
1 vote
0 answers
71 views

The Hosoya Index is the number of independent edge sets (i.e., matchings) in a graph. I have implemented it in Mathematica (based on the source code provided in ...
Ahamad's user avatar
  • 1
4 votes
1 answer
250 views

The treewidth of an undirected graph is a very important concept in graph theory. I have ported the python code from a related Code Golf question to Mathematica, and it has passed the test cases. ...
Ahamad's user avatar
  • 1
1 vote
1 answer
151 views

For a bipartite graph, the local clustering coefficient of a node $v$ is the number of rectangles containing $v$ as a fraction of (something like, depending on the definition) the total number of ...
apg's user avatar
  • 2,303
1 vote
0 answers
69 views

The cover time of a graph is the expected time it takes a simple random walk on the graph to visit every node. Related MSE post.       How to accelerat the Mathematica code calculating cover time of ...
Ahamad's user avatar
  • 1
2 votes
1 answer
130 views

I am using the code provided in the answer for this other question. It is shown below: ...
JYB's user avatar
  • 51
0 votes
0 answers
87 views

Using Mathematica 14.2 I am trying to run the following built in function: CommunityGraphPlot I'm getting the following error message: ConvexHullMesh::affind When trying to run examples provided in ...
Kamil's user avatar
  • 1
3 votes
1 answer
135 views

By definition, a planar graph is a graph that can be represented on a plane without intersecting edges. ...
ayr's user avatar
  • 2,665
6 votes
2 answers
398 views

Bug introduced in 13.0 or earlier and persisting through 14.2.1 or later The following produces correct outputs. ...
azerbajdzan's user avatar
  • 32.8k
2 votes
2 answers
255 views

I have a graph I have When I go A-> B -> C->D->E->A I get the sum 23, and How can I find the numbers like the graph. I tried ...
TTTT2025's user avatar
  • 167
5 votes
1 answer
379 views

I am trying to make a graph from an arbitrary solution from reduce so that it looks prettier and is more readable. My question is very similar to the question How can I make the output of Reduce more ...
Romogi's user avatar
  • 687
0 votes
0 answers
94 views

I'm trying to find all subsets of edges in a graph that do not form a cycle. Currently, my approach is to generate all subsets of the edge set and use AcyclicGraphQ ...
internet's user avatar
  • 1,417
0 votes
0 answers
79 views

I'm trying to find all cycles in the multigraph below. However, the returned cycles seem to be only fundamental cycles. I was expecting around 8 cycles instead. Is this a bug, or am I missing ...
internet's user avatar
  • 1,417
1 vote
1 answer
114 views

GraphUnion doesn't seem to produce the correct result. The output should be four blocks connected in a chain, but it's not. This appears to be another bug in ...
internet's user avatar
  • 1,417
1 vote
1 answer
103 views

Does anyone know how to split a graph based on given articulation points? Below is an example of a graph with two articulation points. The expected result after splitting would be three separate ...
internet's user avatar
  • 1,417
2 votes
1 answer
173 views

In the following code, I expected that only the edge between vertices 0 and 1 would be removed. ...
internet's user avatar
  • 1,417
5 votes
3 answers
380 views

I have a list of vertices (denoted by integers) with larger index that each vertex connects to, like below: ...
qwerty's user avatar
  • 1,497
4 votes
0 answers
221 views

I need random Hamiltonian cycles in directed graphs. I guess for me it would be OK to mean by that choosing uniformly randomly from the set of all Hamiltonian cycles. ...
მამუკა ჯიბლაძე's user avatar
2 votes
1 answer
152 views

Is it possible to have a particular edge in a graph represented by an arc instead of a straight line? The reason is that for my particular vertex positioning one of the vertices is colinear with a ...
frank 's user avatar
  • 29
1 vote
2 answers
112 views

I have two graphs, g1 and g2, defined as follows: ...
internet's user avatar
  • 1,417
2 votes
1 answer
253 views

Mason's gain formula (MGF) is a method for finding the transfer function of a linear signal-flow graph (SFG). I'm trying to port the MATLAB code to Mathematica code, but the Mathematica code outputs ...
Ahamad's user avatar
  • 1
5 votes
1 answer
244 views

How can I split a graph into two subgraphs, as shown in the image below, given a pair of cut vertices? (Let's assume the user ensures that a valid pair of cut vertices is provided.) The possible cut ...
internet's user avatar
  • 1,417
5 votes
1 answer
291 views

Are there any algorithms or functions to find 2-isomorphic graphs (second isomorphism), either built into Mathematica, IGraph, or available in other programming languages? I've been searching, but ...
internet's user avatar
  • 1,417

1
2 3 4 5
46