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
4 votes
1 answer
64 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 ...
Emad kareem's user avatar
1 vote
1 answer
78 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 ...
Tugrul Temel's user avatar
  • 6,184
5 votes
1 answer
70 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 ...
towerglove's user avatar
4 votes
1 answer
109 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 ...
herbertfederer's user avatar
1 vote
2 answers
109 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 ...
licheng's user avatar
  • 2,019
3 votes
2 answers
191 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, ...
internet's user avatar
  • 733
0 votes
0 answers
56 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 ...
licheng's user avatar
  • 2,019
1 vote
1 answer
70 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. ...
licheng's user avatar
  • 2,019
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 ...
მამუკა ჯიბლაძე's user avatar
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: ...
licheng's user avatar
  • 2,019
1 vote
1 answer
147 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. ...
Tugrul Temel's user avatar
  • 6,184
2 votes
0 answers
82 views

Why are WeightedAdjacencyMatrix and WeightedAdjacencyGraph inconsistent?

I have a weighted adjacent matrix of a graph: ...
licheng's user avatar
  • 2,019
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: ...
user13892's user avatar
  • 9,313
3 votes
1 answer
135 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 ...
Peter Olson's user avatar
2 votes
2 answers
63 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 ...
Juan Felipe Salamanca Lozano's user avatar
0 votes
0 answers
42 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 ...
licheng's user avatar
  • 2,019
1 vote
0 answers
150 views

How to construct a layered 3D graph of three community structures?

Consider: ...
Tugrul Temel's user avatar
  • 6,184
2 votes
1 answer
124 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 ...
138 Aspen's user avatar
  • 1,124
3 votes
0 answers
79 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 ...
Javier J Navarro's user avatar
2 votes
1 answer
114 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 ...
geoffrey's user avatar
  • 837
1 vote
0 answers
58 views

Why is GraphPropertyDistribution[.] taking an infinite amount of time to run?

This code is from the documentation: ...
Tugrul Temel's user avatar
  • 6,184
6 votes
2 answers
290 views

How to get better labels for this Graph?

...
CasperYC's user avatar
  • 1,550
3 votes
2 answers
178 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 ...
Poseidaan's user avatar
  • 155
2 votes
1 answer
59 views

What is the matter with EdgeList[] of a directed graph?

Given: ...
Tugrul Temel's user avatar
  • 6,184
3 votes
1 answer
550 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 <...
Tugrul Temel's user avatar
  • 6,184
3 votes
2 answers
196 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 ...
Syed's user avatar
  • 49.3k
6 votes
3 answers
446 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 ...
eldo's user avatar
  • 62.2k
2 votes
3 answers
195 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[...
bkarpuz's user avatar
  • 799
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 ...
Tugrul Temel's user avatar
  • 6,184
6 votes
4 answers
664 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 ...
eldo's user avatar
  • 62.2k
1 vote
1 answer
117 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 ...
apg's user avatar
  • 2,037
2 votes
0 answers
39 views

How to extract Graph Button wrappers / annotations?

graph= Graph[{Button[1->2, Echo["click"];]}]; InputForm @ graph ...
Kuba's user avatar
  • 137k
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$. ...
licheng's user avatar
  • 2,019
9 votes
1 answer
373 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. ...
Tugrul Temel's user avatar
  • 6,184
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 ...
Tugrul Temel's user avatar
  • 6,184
4 votes
2 answers
182 views

How to create a size-adjusted community graph with eigenvector centrality bubles

Given this: ...
Tugrul Temel's user avatar
  • 6,184
0 votes
0 answers
86 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}}{\...
Daniel Castro's user avatar
2 votes
2 answers
175 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,...
licheng's user avatar
  • 2,019
4 votes
1 answer
146 views

Select a specified subset of vertices distributed on a circle

A circular embedding is a graph embedding in which all graph vertices lie on a common circle, usually arranged so they are equally spaced around the circumference. If I only specify that some of the ...
licheng's user avatar
  • 2,019
0 votes
0 answers
71 views

Why does the string "\" prevent a graph6 string conversion to a graph?

I input the graph6 string ...
licheng's user avatar
  • 2,019
3 votes
4 answers
353 views

How to use Callout in a directed graph with circular embedding?

Given the following code: ...
Tugrul Temel's user avatar
  • 6,184
5 votes
3 answers
366 views

En route to Mobile (driving distances)

I want to find a nice way to display driving distances, but got stuck with the following problem: 1. Example data ...
eldo's user avatar
  • 62.2k
2 votes
1 answer
141 views

How to map community structure with circular embedding and normalized edge weights?

Given: ...
Tugrul Temel's user avatar
  • 6,184
2 votes
0 answers
65 views

"RegularHyperbolicTilingGraph" Does Not Work Properly [closed]

I am trying to draw regular hyperbolic tesselations using the "RegularHyperbolicTilingGraph" function on Mathematica 13. Here is the introduction of this function on the repository: https://...
Tianyi Wang's user avatar
0 votes
0 answers
70 views

Find all the cycle in a graph including the one with vertex repetition

I have a simple graph given by ...
Dario Bercioux's user avatar
3 votes
1 answer
60 views

Discrepancy between `IGEigenvectorCentrality` and `EigenvectorCentrality` in Mathematica

I've been experimenting with directed graphs in Mathematica and I'm having some difficulty understanding the differences between IGEigenvectorCentrality and ...
cconsta1's user avatar
  • 155
0 votes
0 answers
63 views

Unusual behaviors of PlanarFaceList

To describe this question clearly, we have to provide some strict definitions regarding planar (plane) graphs. First, we consider connected graphs. A plane graph is a particular drawing of a planar ...
licheng's user avatar
  • 2,019
0 votes
0 answers
55 views

Comparing graphs in mathematica: shape vs. name

I'm trying to identify and remove duplicate graphs when contracting vertices. To illustrate this, I'll start with two simple graphs where I'm trying to create a function that can recognize them as ...
hana's user avatar
  • 2,318
2 votes
1 answer
128 views

How can one convert between mtx format and graph format?

There are various variants of graph coloring, such as when I want to compute the star chromatic number of a graph, Mathematica seems not to provide relevant functions. Fortunately, the software ...
licheng's user avatar
  • 2,019
5 votes
1 answer
82 views

Find a maximum $k$-colorable subgraph

For a given graph, the Maximum $k$-Colorable Subgraph Problem is the problem of determining the largest set of vertices of the graph that can be colored using $k$ distinct colors such that adjacent ...
licheng's user avatar
  • 2,019

1
2 3 4 5
44