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
3
votes
1answer
79 views

How Color the PathGraph Showing Multiple Shortest Paths on the US Counties Map

Below is code for mapping the connectivity of US counties. It comes from the Mathematica reference on "Connectivity of US Counties". I've highlighted 3 shortest paths shown in red. However, ...
1
vote
0answers
27 views

`SpatialGraphDistribution` with `DirectedEdges` doesn't work

I want to create a random graph with SpatialDegreeDistribution and want the edges to be directed. ...
1
vote
0answers
49 views

Drawing graphs with many vertices in mathematica [duplicate]

I have been using Mathematica to make graphs out of adjacency matrices. However, once the adjacency matrices get very large, Mathematica does not draw them. My adjacency matrix is a 360x360 matrix. Is ...
0
votes
0answers
24 views

Extracting GraphDistance out of SpatialGraphDistribution

I am trying to generate a graph which has Euclidean distances between the vertices. The documentation for SpatialGraphDistribution says that ...
-4
votes
0answers
34 views

How can I find average clustering coefficient in an undirected Erdos–Rényi graph? [closed]

My question is: What is the average clustering coefficient in an undirected Erdos–Rényi graph with N = 10 nodes and M = 18 links? Here just I have to find p? p is the answer or c=K/N is the answer? L=...
0
votes
1answer
143 views
+100

How to Breakout Edge Betweenness Centrality

Consider the following: ...
1
vote
1answer
23 views

FindCycle with EdgeWeight in directed graphs

Following up on the discussion in Problem with EdgeWeight and FindCycle?, consider the simple directed graph: ...
2
votes
1answer
64 views

How to create a representation of a multilayered neural network from scratch using Graph?

One valid way is given at the end. I thought CompleteGraph[{2, 3, 3, 1}] would create the representation that I wanted but it creates too many edges (from the first ...
3
votes
1answer
65 views

Can one hide the vertex of a graph or create an edge that passes through a specific point in the underlying coordinate space?

If one creates a graph with two edges between the same two vertices, WL draws them in a default coordinate space in which the two edges that pass-through coordinate positions that are placed on curved ...
4
votes
2answers
84 views

How to link a variable to vertices of a directed graph using bubles with different sizes

This Code produces a directed graph: ...
2
votes
0answers
100 views

Dense packing of disks with different radii

Let's consider a disk ($D_{1}$) whose center position is randomly generated, but the radius is fixed at $r_{1}$. A second disk ($D_{2}$) of fixed radius $r_{2}$ (with $r_{2} < r_{1}$) is randomly ...
1
vote
1answer
81 views

Finding a mapping between two graphs

I am trying to find a function / algorithm that will search and find a mapping between an irregular graph (say, N-nodes with maximum vertex degree-K but otherwise irregular) into a regular L-nearest ...
8
votes
2answers
220 views

How to plot a signal (function) on a graph (object of graph theory)

Given a graph of n vertices, it is possible to plot a discrete signal (or function) of n samples on the vertices of the graph, so that one can visualize the features of the signal on the graph (see ...
1
vote
1answer
89 views

Why does Mathematica not display networks? [duplicate]

Why does Mathematica not display (and export) the graph 'g' when n> 10000? n = 10000; g = RandomGraph[BarabasiAlbertGraphDistribution[n, 1]] ralph
3
votes
0answers
64 views

Representing and Extracting Properties of a System Product Breakdown Structure (a Directed Acyclic Graph)

I am trying to analyze products using a product breakdown structure (PBS), which is a directed acyclic graph (DAG) that reflects a decomposition of the product into subproducts, sub-sub-products, and ...
3
votes
2answers
74 views

How can one calculate the co-normal (disjunctive/or) product of two graphs in Wolfram Language?

I'm trying to verify a result in Wolfram Cloud. The standard cartesian graph product is implemented. Graph join is implemented. But it seems that the co-normal product does not seem to be, and ...
2
votes
1answer
74 views

How to get neighbor lists in the same order/orientation from a periodic IGTriangularLattice[] graph?

Using IGraphM, I want to get the VertexComponent[] neighbors around all nodes, in a periodic IGTriangularLattice[] graph. To do ...
2
votes
2answers
128 views

Determine Level Structure of Graph

I am trying to output the level structure of a graph (for example, a graph with edges {{1,2},{2,3},{3,4},{3,5},{3,6},{4,7}} would have a level structure {1: {1}, 2: {2}, 3: {3}, 4: {4, 5, 6}, 5: {7}})....
2
votes
1answer
68 views

Rename a Graph Vertex [closed]

We have VertexAdd, VertexDelete, EdgeAdd, EdgeDelete but no VertexRename. Is there a simple way to achieve this? I fiddled around with AnnotationValue,AnnotationKeys,IndicedenceList etc to create a ...
2
votes
1answer
51 views

IGMotifsVertexParticipation Problem

I have a directed acyclic graph with 194 vertices and 492 edges. I was able to get the 3-motifs without a problem. However, when I ran IGMotifsVertexParticipation I got an error message. I ran the ...
0
votes
0answers
48 views

Visulisation of k-core decomposition complex network

How can I visualize a complex network in the way it is presented in Fig. 4 the following article: https://proceedings.neurips.cc/paper/2005/file/b19aa25ff58940d974234b48391b9549-Paper.pdf ? I have ...
3
votes
2answers
194 views

Compute a subdivision graph

I'm trying to compute a subdivision graph of an arbitrary graph by adding one vertex in the middle of each edge of the graph.
4
votes
1answer
164 views

FindPath with required Edges

Suppose I have a graph g with some edges reqEdges (in the example code here, just one edge). I would like to use ...
6
votes
2answers
211 views

How to find all possible paths between a collection of vertices in a DAG graph

I have a toy example "system" that is a DAG and has 16 vertices. Suppose I have a collection of vertices "collection". How can I find all paths that passes through at least all ...
4
votes
0answers
65 views

VertexInComponent not working properly on edgless graphs

Bug introduced in 12.1 and persisting through 12.3.1 Note: The 3rd argument of VertexInComponent was introduced in 12.1. The code ...
2
votes
0answers
56 views

FindCycle Evaluation Time Diverges

I have a data set of 257,182 edges between 32,849 vertices forming a directed graph. I would like to use FindCycle to analyse its cycle structure. Unsurprisingly, ...
0
votes
0answers
29 views

FindSpanningTree not working properly on directed graph with negative weights

The code: ...
1
vote
2answers
56 views

Is there a way to make FindSpanningTree return a directed graph?

I would like to use edge-direction to distinguish between parents and children in a given spanning tree. When choice of root-node is not unique FindSpanningTree ...
3
votes
1answer
63 views

Efficient way to get all $k$-factors of a graph $G$?

In Graph factorization, a $k$-factor of a graph $G$ is a spanning $k$-regular subgraph which has the same vertex set as $G$. Now I have a random graph $g$ (i.e. complete graph for simplicity) and I ...
6
votes
2answers
193 views

Plotting of probability density on a lattice and studying dynamics

I have a lattice described by a AdjacencyMatrix or Hamiltonian. This matrix has all the information of how each site is connected to another site with what hopping ...
4
votes
1answer
102 views

Make Graphs with disjoint edge sets that have different colors?

I would like to obtain the related graphs in mathematica which look like the following picture took from this link: What I do: I have all the edge lists for the above graphs. ...
2
votes
2answers
67 views

According to the path, how to draw such a binary tree?

As shown in the figure, the path can be generated by the following code ...
0
votes
0answers
40 views

How to creat a high-quality graph image for MorphologicalGraph to convert to graphs (it can't detect some edges in mine)?

I'm using MorphologicalGraph to convert images to graph. This is my source image: Following this and this, I tried ...
4
votes
2answers
146 views

Connecting simple lines from (large) unsorted list of points

Context We are trying to predict the formation of discs of intermediate mass black hole orbiting super massive black holes in galactic centres. This involves finding calorific curves in energy and ...
10
votes
2answers
386 views

Arbitrary lattice graph in 2D

My purpose is to generate a graph representing a lattice, where the vertices are essentially the lattice sites. This lattice has to be periodic. That means the opposite boundaries are identical. MWE ...
2
votes
0answers
37 views

Different codes give different star embedding graph layout

I usually use the following code to generate a star embedding graph layout. ...
2
votes
1answer
94 views

Efficient way to pick up pairwise vertices of certain Euclidean distance in arbitrarily dimensional coordinates? [closed]

I have a grid graph with x and y vertices in each direction. The 2-dimensional coordinates of the graph ...
7
votes
1answer
109 views

How to get Gallai-Edmonds decomposition of a graph?

In graph theory, the Gallai–Edmonds decomposition is a partition of the vertices of a graph into subsets satisfying certain properties. Describe it in more detail. from here To get the maximum ...
3
votes
2answers
68 views

How to calculate and display possible graphs from 3 directed branches?

I have 3 directed branches and I want to create all possible graphs that can be created from these branches with the condition that each branch is used once. Q1: How can I do create and graph them? ...
1
vote
4answers
333 views

Generate Hexagon within Hexagon and show only certain connections

How can I generate the hexagons shown? I'd like to add names to all the disks and the colored links. And rotate the whole thing by 30 degrees.
1
vote
1answer
91 views

How to display all graph layouts at once?

I often find myself manually trying different graph layouts (Radial Drawing, Layered Drawing, etc ...) to find the best possible visualization for graphs. Is there a quick command to display ALL graph ...
1
vote
2answers
59 views

Retain Edge Ordering in DAG Conversion

I would like to convert an undirected graph into a directed graph such that for each tuple, the first value is a head and the second is a tail in a directed edge. Initially I thought using ...
1
vote
2answers
54 views

Color-code edges by order in edge list

Given a graph with vertex coordinates list V and edge list E, how can I visualize the order of appearance of edges in E? It is similar to this and this question which ask how to color-code points in a ...
8
votes
0answers
236 views

Improving label collisions for Tree/Graph?

Historically, MMA has never handled label collisions well, but recently they added some improvements here via things like Callout. I want to fix ImageSize but still ...
4
votes
2answers
289 views

Generate Aztec triangle of size n automatically?

In the paper titled "Perfect Matchings of Cellular Graphs" by Mihai Ciucu, the Aztec triangle of size n (n= 1, 2, 3, 4, 5, ...) is equivalent to a ...
2
votes
1answer
59 views

How to mark nodes and insert weights in an adjacency graph?

I have a graph with 12 nodes. The x and y coordinates are give as ...
2
votes
1answer
57 views

Output vertex pair(s) whose distance is the graph's diameter

Assuming you have a connected graph (in my case also undirected and equal/no edge weights), how could you see all the vertex pairs whose shortest length path is equal to the graph's diameter? An ...
1
vote
1answer
48 views

How to represent a subgraph of a directed graph as a LayeredGraph with EdgeWeights

The following code generates: The first element is a layered graph of the original system sam. The second element is a list of ...
7
votes
3answers
255 views

Generating a weighted oriented lattice

I have a periodic lattice, and I would like to associate some phase parameters connecting to the neighbors that can be thought of as a hopping parameter. Now the choice of these phase parameters is ...
1
vote
1answer
57 views

How to Build Up the Betweenness Centrality Score

Can the Betweenness Centrality score FOR EACH VERTEX in a graph be deconstructed as follows. For instance, in the graph below, the betweenness centrality score of vertex D is 3.5. Can this calculated ...

1
2 3 4 5
37