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.
2,163
questions
5
votes
2
answers
173
views
How to find fundamental cycles in a multiple edge graph?
I tried to find the fundamental cycles of a multiple edge graph below, but it doesn't seem to work.
Is it true that the built-in function FindFundamentalCycles does not work with multiple edge graphs? ...
2
votes
1
answer
73
views
Removing `circular rules'
Say that I have a huge list (>300.000 elements) of polynomial equations and I want to simplify these by
looking for some simple equations of the form x[i] == _ ...
2
votes
0
answers
39
views
Tree edge label visibility and legibility
I am building some tools to help me visualize fitting of generic n-dimensional nonlinear model. I have the data and results stored in a nested association. I've written a few functions to generate a <...
0
votes
0
answers
25
views
How to generate a graph and label all vertices with eccentricity of each vertex and then count the edges of generated graph with same end vertices? [duplicate]
I want to generate a graph. Add degree of neighborhood vertex. and count the edges of edges with same end vertices of the graph.
0
votes
0
answers
18
views
How we can find neighborhood degree sum vertices and find count edges of same end vertices? [duplicate]
I am new in Mathematica. I want to draw a graph then add the degree of neighborhood vertices and generate a graph with neighborhood vertices sum degree. At next step I want to count edges of ...
3
votes
2
answers
122
views
Output of IsomorphicGraphQ
Is it same for newer versions of Mathematica that IsomorphicGraphQ has problems with multiple self-connected edges?
...
3
votes
0
answers
57
views
Graph with non-integer vertices
Why the following works only with integers and if other names of vertices are used UndirectedEdge is needed?
...
1
vote
1
answer
280
views
How to solve and output the coloring problem in permutations and combinations?
Apply the four different colors red, yellow, green, and black to the areas in the figure shown below, with the requirement that adjacent areas cannot have the same color. How many different coloring ...
1
vote
1
answer
70
views
How to partition graph on vertex degree. And count the number of edges with same end vertices? [closed]
Step-I Input a graph and generate Table
How to partition graph on vertex degree. And count the number of edges with same end vertices as given in table given below. The program also shows the graph ...
0
votes
0
answers
37
views
How to select graphs with specific vertex conditions?
I'm trying to select graphs that have a path with the following conditions:
Include vertices a1, a2, b1, b2.
Vertices a1 and <...
3
votes
1
answer
40
views
How to Replace EdgeLabel in a Graph [duplicate]
I am working with Graphs in which I want to define a Graph with Symbols or Strings as EdgeLabels, and later replace these with functions of the symbols with symbols then replaced with numerical values....
3
votes
1
answer
74
views
How to control Graph layout direction
I want to construct signal flow graphs using Mathematica. Below is a simple example. It works well enough except that it draws from right to left. In fact it seems to choose left to right or right to ...
4
votes
1
answer
72
views
EdgeLabels and EdgeLabelStyle of Graph
I try to name edges according to the nodes emerging from them and entering them. Each edge takes a specific name $e_{ij}$.
The following example illustrates what is required
...
1
vote
1
answer
85
views
How to plot a community structure with specific properties
This code generates a community structure where each community is shown with a different color. The same color is used for bars within a community and outgoing edges from that community. I would like ...
5
votes
1
answer
83
views
How can I control curved edges between vertices?
I want to create graphs consisting of many nodes arranged in a line. The nodes have values (which determine their size) and should be arranged in increasing order. A simple example is something like ...
5
votes
1
answer
119
views
How can I remove the exterior face in PlanarFaceList?
For one of the embedding of a planar graph, only one face is the exterior face which contain the ∞ point. In the example as below, the ...
1
vote
2
answers
116
views
How to determine if two colorings of a graph are the same?
A coloring of a graph $G$ with vertex set $V$ is the partitioning of $V$ into so-called color classes so that no two vertices of the same class are adjacent. A $k$-coloring contains exactly $k$ color ...
3
votes
2
answers
195
views
How to remove non-loop vertices in a graph?
How can I remove vertices from a graph that do not form a loop?
For example,
...
0
votes
0
answers
62
views
All BFS/DFS trees starting from a single vertex
Let $G$ be a simple graph. A spanning tree of $G$ is a subgraph of $G$ that is a tree containing every vertex of $G$.
A spanning tree can be built by doing a breadth-first search or a depth-first ...
1
vote
1
answer
71
views
How to obtain positions of graphs satisfying certain conditions?
I first generate some random graphs, and then the following code can filter graphs with maximum degree 8.
...
1
vote
0
answers
58
views
A cryptic message when converting a Graph to Graphics
In Mathematica 13.3 (Windows 11) I do
Graph[{1, 2}, 1 \[UndirectedEdge] 2]
then right-click on the result and choose "Convert To Graphics" from the menu ...
1
vote
0
answers
98
views
How to speed up data stream (with graph6 format) reading?
I attempt to filter connected graphs with 8 vertices, 14 edges, and matching number three using the 'geng' tool and IGraphM.
First way:
...
1
vote
1
answer
148
views
How can a directed network model be linked to Dataset[ ] for further computation?
REVISED Question:
My only request is to know how to monitor the evolution of {agentStates, steps} in simulateSlow[...] function. ...
2
votes
0
answers
83
views
Why are WeightedAdjacencyMatrix and WeightedAdjacencyGraph inconsistent?
I have a weighted adjacent matrix of a graph:
...
2
votes
0
answers
75
views
How to get the optimal arrangement minimizing depth and maximizing level usage for a dependency tree graph?
Given a graph like as follows:
...
3
votes
1
answer
145
views
How do I find all the nets of a polyhedron?
The following will show me a single example net of a polyhedron
PolyhedronData["Dodecahedron", "Net"]
And
...
2
votes
2
answers
72
views
Graph with fixed vertex layout but curved edges
I have constructed a graph (network) whose vertices I want to be arranged in a square grid, I have already done this by means of the "GridEmbedding" GraphLayout, however this layout makes ...
1
vote
0
answers
49
views
Convert a graph to Lad format using a concise method
The LAD format is a kind of graph formats; see https://perso.liris.cnrs.fr/christine.solnon/SIP.html
The specific format requirements are as follows:
Each graph is described in a text file. If the ...
1
vote
0
answers
151
views
2
votes
1
answer
155
views
How to implement the formula for the number of undirected $k$-cycles in a graph $G$?
This Wolfram MathWorld page said that,
Giscard et al. "A General Purpose Algorithm for Counting Simple Cycles and Simple Paths of Any Length." 16 Dec 2016. gave the formula for the number of ...
3
votes
0
answers
84
views
Drawing the Graph of a complex chemical reaction network
I'm interested in how Mathematica or IGraph/M package can help with the visualization of complex chemical reaction mechanisms applied in fields like combustion, biochemistry, water radiolysis, or ...
2
votes
1
answer
120
views
How can I determine the cycle lengths in a directed graph?
I have a directed graph:
a = {{0, 1, 0, 0}, {0, 0, 1, 0}, {1, 0, 0, 1}, {1, 0, 0, 0}};
AdjacencyGraph[a]
I want to determine the cycle lengths in the directed ...
1
vote
0
answers
58
views
Why is GraphPropertyDistribution[.] taking an infinite amount of time to run?
This code is from the documentation:
...
6
votes
2
answers
295
views
3
votes
2
answers
182
views
How to see if two graphs are the same (including node names)?
I want to check whether the two graphs are the same. With the same, I mean that they have the same edges and nodes.
For example, I want
...
2
votes
1
answer
59
views
3
votes
1
answer
557
views
How to simulate a directed acyclic graph?
My goal is to have a code to identify and estimate the regression models associated with a directed acyclic graph (DAG), which is obtained through the reduction of a given weighted, directed graph <...
3
votes
2
answers
198
views
Keys in the vicinity
What I want to do is to recognize keys in the image and create a list of keys around every key that fall within a pentagonal (or similar) region. These are the ones that can be accidentally pressed ...
6
votes
3
answers
453
views
How to produce a Calder mobile?
Alexander Calder (1898 - 1976) was an American artist known for for his mobiles and his public sculptures.
Here are two examples of his mobiles which I want to approximately reproduce with ...
2
votes
3
answers
197
views
Sorting a list of lines such that they are successively connected
I have a list of line segments of the form $\{u_1,u_2,\cdots,u_n\}$, where $u_{k}$ is of the form $\{\{a_k,b_k\},\{c_k,d_k\}\}$. I want to sort them as $\{v_1,v_2,\cdots,v_n\}$ in such a way that Last[...
0
votes
0
answers
79
views
Which algorithms are implemented in community detection based on AdjacencyGraph[.] and WeightedAdjacencyGraph[.]?
The following code generates two distinct community structures: one uses a simple adjacency matrix (with 1 and 0), another uses a weighted adjacency graph (with positive real numbers). I like to know ...
6
votes
4
answers
666
views
Find a certain path through a matrix
I would like to get a functional solution and nice display form for the following problem:
1. Example data
...
1
vote
1
answer
124
views
Visualising assortativity in networks
Assortativity and disassortativity are graph properties that represent how hub-and-spoke-like a graph is, where assortative graphs have hubs that connect to each other, while disassortative graphs ...
2
votes
0
answers
39
views
How to extract Graph Button wrappers / annotations?
graph= Graph[{Button[1->2, Echo["click"];]}];
InputForm @ graph
...
3
votes
2
answers
197
views
How to efficiently determine if a graph contains an (a, b)-edge?
Let $G$ be a graph. The degree $d_G(v)$ of a vertex $v$ in $G$ is the number of edges that are incident to $v$. An edge $uv$ in $G$ is called an $(a, b)$-edge if $d_G(u) = a$ and $d_G(v) = b$. ...
9
votes
1
answer
374
views
How to replace graph communities with the associated bar charts?
The following code generates a community graph and a set of bar charts, each one of which corresponds to a community.
...
0
votes
0
answers
63
views
How to create a customized layered community structure from a directed graph
This answer provides a code for scaling the sizes of communities. I like to make the presentation of the community structure given in this answer (by @kglr) a bit more informative and friendly by ...
4
votes
2
answers
182
views
0
votes
0
answers
87
views
Solving the clothing problem with Mathematica
Given a surface $\mathbf{r}:\mathbb{R}\rightarrow \mathbb{R}^3$, the Chebyshev clothing problem consists in finding a parametrization $(u,v)$ such that
\begin{align}
\left|\frac{\partial \mathbf{r}}{\...
2
votes
2
answers
182
views
How to declare a string as unescaped after storing in a variable?
Continuing from my previous question, this issue is an extension of it.
This issue is somewhat similar to how-do-i-make-a-string-literal-without-having-to-escape-backslashes? but not entirely the same,...