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

### Minimum Distance to Fly to Each European Country

Help me plan my holiday. These are all my available flights that I can get on airline points. I'm trying to work out what is the shortest distance to travel if I want to go to each every European ...
• 4,558
74 views

### How to Implement Progressive Cell Coloring in a General Mesh or Tiling?

Here are some examples of what I am talking about using Voronoi for simplicity: Given: That can be colored depending on which cell is randomly chosen: I feel like there would be a better name for ...
243 views

### How to Pick Out Strings of a Specified Length

Suppose I have the following edge set: ...
• 1,773
147 views

### How to Control StringContainsQ [duplicate]

I have the following code ...
• 1,773
1 vote
83 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 ...
1 vote
48 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 ...
64 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,773
46 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
117 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
174 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 ...
• 785
1 vote
71 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,059
129 views

### Is this graph planar?

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

### Grids for FindShortestPath

how to create a program that produces a screenshot-like effect?
• 1,854
146 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,523
89 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,773
122 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,521
352 views

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

For the following image: The attached code produces a graph. ...
• 4,521
112 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 ...
• 785
1 vote
91 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 ...
187 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? ...
• 785
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,620
99 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 <...
269 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 ...
• 785
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 ...
130 views

### Output of IsomorphicGraphQ

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

### Graph with non-integer vertices

Why the following works only with integers and if other names of vertices are used UndirectedEdge is needed? ...
• 20.1k
1 vote
301 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,521
1 vote
75 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 ...
40 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 <...
• 785
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
84 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
75 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 ...
• 914
1 vote
87 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
87 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 ...
153 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,059
196 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, ...
• 785
76 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,059
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,059
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,076
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,059
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
90 views

I have a weighted adjacent matrix of a graph: ...
• 2,059
78 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,523
170 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
79 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
63 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,059
1 vote
155 views

Consider: ...
• 6,233
162 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,593