# 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,180 questions
Filter by
Sorted by
Tagged with
1 vote
77 views

### Make a loop while graph is not empty

I'm new to Mathematica and I'm attempting to write an approximation algorithm to compute "maximum" independent sets. What I need to do is given a graph g ...
41 views

### Removing a vertex and all its neighbors in a graph

I'm implementing an approximation algorithm to compute "maximum" independent sets. It requires that I remove a minimum degree vertex and all its neighbors. I can find the vertex of minimum ...
59 views

### What does the betweenness centrality value of a vertex generated by Mathematica actually mean?

Suppose I have a vertex A in a directed graph. Suppose Mathematica computes its betweenness centrality is 29000.3. What does 29000.3 actually represent? Does it mean 29000.3 times vertex A is on all ...
• 1,673
42 views

### Harmonious labeling of a graphs

is harmonic labeling possible in Mathematica? then how to find all possible harmonic labelings on a graph using Mathematica
• 11
110 views

### Hanoi graph in Mathematica [closed]

Is hanoi graph available in Mathematica program? if so, can you show me the code while if not, can we input or build the hanoi graph?
• 11
153 views

### How can I find all equivalent swapping of some edges in a graph?

This is related to electrical networks, so let me explain a bit about it first. Assume that I have a branch or a loop consisting of only voltage sources in series, as shown below. We know that if we ...
• 547
1 vote
67 views

### Find criteria if a graph is not perfect

A graph is perfect if the clique number and the chromatic number is the same for every induced subgraph of the graph. A polynomial-time algorithm exists for determining if a graph is perfect. ...
• 2,049
120 views

### Is this graph planar?

The PlanarGraph command displays graphs using a planar embedding if possible. Thus, quite expectingly ...
• 19.1k
410 views

### Grids for FindShortestPath

how to create a program that produces a screenshot-like effect?
• 1,856
143 views

### How to specify the position of Arrowhead in Graph's EdgeShapeFunction?

I have a graph defined as follows: Graph[ ..., EdgeShapeFunction->{(_\[DirectedEdge]_)->{"FilledArrow","ArrowSize"->0.02}} ] I ...
• 9,483
83 views

### Weighted Graphs

Can the centrality measures in Mathematica (e.g., degree, betweenness, edge betweenness) be adjusted for weight on the edges, where weights represent the volume of an item (say, in Kg)? This would be ...
• 1,673
1 vote
37 views

### How can I make length and width of this edge label scale with the graph? [duplicate]

How can I make length and width of this edge label scale with the graph? ...
• 547
117 views

### MorphologicalGraph returning different graphs for visually indistinguishable images

I am using MorphologicalGraph on two images, which are visually indistinguishable, but the resulting graphs are different. ...
• 4,341
341 views

### How to obtain the list of outermost graph nodes

For the following image: The attached code produces a graph. ...
• 4,341
109 views

### How to list all vertex of a one-cycle graph in order (cw or ccw)?

Assuming I have a graph with a single cycle below, I want to list the vertices of this cycle in order. Whether it's clockwise (CW) or counterclockwise (CCW) is okay, as long as we are consistent. So ...
• 547
1 vote
88 views

### Connected-component labeling in Mathematica? [closed]

I needed an implementation of the well-known one-pass connected-component labeling algorithm, see https://en.wikipedia.org/wiki/Connected-component_labeling and I have programmed it myself according ...
181 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? ...
• 547
77 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] == _ ...
• 1,580
49 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 <...
1 vote
264 views

### How can I find all the different ways to group integer numbers from 1 to 10 into 3 lists?

(Unfortunately, I couldn't change the bounty message. By n above I meant the number of sublists.) How can I group a list of integers from 1 to 10 into 3 sublists of ...
• 547
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.
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 ...
126 views

### Output of IsomorphicGraphQ

Is it same for newer versions of Mathematica that IsomorphicGraphQ has problems with multiple self-connected edges? ...
• 19.7k
58 views

### Graph with non-integer vertices

Why the following works only with integers and if other names of vertices are used UndirectedEdge is needed? ...
• 19.7k
1 vote
292 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 ...
• 4,341
1 vote
74 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 ...
38 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 <...
• 547
41 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....
• 4,604
79 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,604
74 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 ...
• 874
1 vote
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 ...
• 6,233
86 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 ...
150 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,212
1 vote
118 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 ...
• 2,049
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, ...
• 547
71 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 ...
• 2,049
1 vote
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. ...
• 2,049
1 vote
59 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 ...
• 2,066
1 vote
99 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: ...
• 2,049
1 vote
149 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. ...
• 6,233
84 views

I have a weighted adjacent matrix of a graph: ...
• 2,049
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: ...
• 9,483
160 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 ...
• 133
75 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
57 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 ...
• 2,049
1 vote
154 views

Consider: ...
• 6,233
161 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 ...
• 1,541
93 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 ...
132 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 ...
• 867
1 vote