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
2
votes
0answers
22 views

VertexInComponent not working properly on edgless graphs

The code VertexInComponent[ Graph[{v1, v2}, {v1 \[DirectedEdge] v2}], v1, {1}] gives the correct answer {}, as there are no ...
2
votes
0answers
48 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
24 views

FindSpanningTree not working properly on directed graph with negative weights

The code: ...
1
vote
2answers
47 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
59 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
182 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
97 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
57 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
38 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
143 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
339 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
86 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 ...
6
votes
1answer
93 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
66 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
326 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
85 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 ...
0
votes
2answers
54 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
50 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 ...
6
votes
0answers
167 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
287 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
52 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
52 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
47 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
247 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
48 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
vote
1answer
42 views

Change the direction of travel of the vertex in a circular Graph

With the function Graph and the option GraphLayout --> "CircularEmbedding", i manage to obtain the graph drawn in the way i want. But, the vertex are ...
4
votes
1answer
113 views

Fast enumeration of all perfect matchings in complete graph

I have a code that generates the list with all possible Perfect Matchings (PM) of a fully connected graph. Each edge of the graph is mono or bi-colored with up to ...
1
vote
1answer
61 views

Problem to draw a graph in circular way [closed]

I draw a graph with the Graph function with the following manner ...
0
votes
1answer
104 views

Plotting a complete graph with a given image as vertices [closed]

I am trying to plot a complete graph using a png image for the vertices. I tried a "drag and drop" approach with VertexShape, but the software gets ...
2
votes
1answer
53 views

Marking communities in a weighted adjacency graph based on a threshold

There are a few questions that are close to what I seek, most notably this one, but none quite right. I want to exploit Mathematica's CommunityGraph style in which a boundary is drawn around a "...
2
votes
2answers
97 views

FindCycle problem in calculating the rings that contains face

I have a matrix that implements a periodic boundary conditions for a graph. Now, I am interested in the cycles in this graph. However, the cycles are not what I expect. To illustrate my point. When I ...
1
vote
2answers
63 views

How to specify shape of network with Graph function?

I have the code you see below which displays the network that you see. However, I want to structure it so that it is flipped horizontally, and the 2, 3, 4, 5 quadrilateral is a square, and so that the ...
4
votes
1answer
87 views

Plotting the following spin chain of atoms

I want to plot one dimensional chain of atoms and interactions between them as shown similar to shown in following two figure. Any suggestions or help ??
1
vote
1answer
47 views

Edge thickness in directed path graph doesn't respond

I have the following code to draw a lattice path in 3D: ...
1
vote
0answers
96 views

Mathematica 12.0 crashed when printing a graph

My Mathematica crashes when I simply print a graph to a PDF. For example, when I input this: Graph[{0->1}] and then print(using the right-click menu) its output ...
3
votes
2answers
74 views

How to extract the adjacency matrix associated with a subgraph defined by FindPath

For a directed graph g, one can obtain its adjacency matrix as: ...
1
vote
1answer
87 views

Modelling transparent boundary conditions on a three-bonded quantum graph

I've created two issue last year, but unfortunately was able to return to this problem only now. This question is a continue to this issue. Essentially I am now trying to apply a solution from the ...
3
votes
1answer
80 views

Graphing Markov chains / decision trees

I'm looking to graph a simple one-way Markov chain, which is effectively a decision tree with transitions probabilities. One way I've got this working in here in an MWE, here's a simple Markov chain ...
0
votes
0answers
28 views

IGraphM error creating a list of motifs using IGMotifs[]

A follow up from a previous question Detecting patterns in a graph network Thanks to @Szabolcs ...
0
votes
1answer
66 views

Add options to a graph after construction

Given a graph which has already been constructed, how can I add, e.g., the option VertexSize -> 3 to that graph without having to deconstruct the graph?
5
votes
1answer
149 views

Detecting patterns in a graph network

If we create a random graph Chop[LowerTriangularize[RandomReal[{-1, 1}, {10, 10}], -1], 0.6] /.0 -> \[Infinity] // MatrixForm WeightedAdjacencyGraph[%] How can ...
0
votes
0answers
75 views

Why I cannot see the graph

Why I cannot see the graph? Example: g = RandomGraph[BarabasiAlbertGraphDistribution[100000, 1]] Output: No further analysis of g can be done. Why?
1
vote
1answer
76 views

How to arbitrarily specify a face of planar graph as an external face and draw it?

I learned this theorem in the graph theory textbook. Theorem Every $2$-connected plane graph can be embedded in the plane so that any specified face is the exterior. ...
2
votes
0answers
25 views

VertexShapeFunction with string pattern matching [duplicate]

I am trying to visualize a heterogeneous graph which nodes are categorical. Here is a dummy graph for implementation: Input is ...
4
votes
0answers
50 views

Are these two graphs different?

I was expecting these graphs to be the same. g1 = AdjacencyGraph[{{0}}]; g2 = CanonicalGraph[g1]; FullForm suggests that they ...
0
votes
1answer
46 views

Command the draw a graph [closed]

Let $G$ be a simple undirected graph. Let the set of vertices be $V=\lbrace 1, 2, 3, 4, 5, 6, 7, 8, 9, 10\rbrace $, and let the edges set be $E=\lbrace (a, b): a\text{ divides }b\text{ or }b\text{ ...
4
votes
1answer
70 views

Extracting points and lines from Graph

I was wondering if there is an easy way to extract lines and/or points from a Graph e.g. ...
0
votes
0answers
70 views

Circular graph construction to minimize overlaps

I wish to create a set of circular graphs with 23 vertices. An example is shown below: This may be constructed by taking, for example, a random sample of the range: ...
3
votes
2answers
62 views

Sampling inhomogeneous spatial point processes

I am looking to generate a point process (random set of points) in a disk of radius $R$, but where the intensity measure decays, for $r$ the distance from the origin of the disk, as $\exp(-r^2/2)$. Is ...

1
2 3 4 5
37