# 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.

1,694 questions
Filter by
Sorted by
Tagged with
91 views

### Grouping the list

Let's assume that I have randomly generated list llist = {{0, 1}, {2, 1}, {4, 4}, {0, 3}, {3, 4}, {2, 2}, {2, 3}, {2, 0}}; We can represent this data using the ...
63 views

### What is the best way to draw cluster for every station?

I have a binary matrix "X" of U rows and N columns. Each row of X has 1 to maximum 3 ones. Each row corresponds to a subscriber and every column corresponds to a service point. So, the ones ...
65 views

### NearestNeighborGraph doesn't show a 3D graph when one or more points are Integer and the rest are Decimal?

Bug introduced in 10.3 or earlier and persisting through 12.1.1 When all the points are the same kind, say Integer then ...
69 views

### Compute all trees on a given label set

Given a set of labels {a_1,...,a_n} (with some labels possibly appearing multiple times) I would like to efficiently compute all trees with n leaves labelled {a_1,...,a_n} and 2n-2 nodes. This is ...
47 views

### Counting the number of edges between two graph partitions

Consider the following: g = RandomGraph[WattsStrogatzGraphDistribution[1000, 0.1, 5]] comm = FindGraphPartition[g, 2]; CommunityGraphPlot[g, comm] ...
290 views

### Generate an ε-machine graph from transition probability matrices

I am trying to generate this type of graphic: see Fig.1a from https://arxiv.org/abs/0905.3587. This process is associated with two transition matrices  T^{(0)} = \begin{pmatrix} 0&p&0\\ 1&...
34 views

### Graph styling using HighlightGraph, GraphHighlightStyle and VertexStyleat the same time

I like the style when a graph is highlighted by HighlightGraph with parameter GraphHighlightStyle -> "Thick". But I ...
183 views

### Randomizing Hamiltonian path

How to randomize given path found by FindHamiltonianPath? FindHamiltonianPath outputs just one of possible Hamiltonian paths. ...
67 views

### Overlay Graph3D with Graphics, with aligned coordinates

I have a Graph3D object representing a 3D lattice path ...
25 views

### Edge centrality measures [duplicate]

I have been looking for packages that allow the computation of centrality measures for a network. I could find packages like Networkx that have implementations of node centrality measures. However, I ...
96 views

### Colouring faces of a graph according to an overlap of edges

I have a basic graph such as the following; ...
316 views

### Dynamically drag graph vertices

Is it possible to make a dynamic graph with an ability to drag vertices? In other words let vertices behave like Locators and change its ...
36 views

### Extract original vertex from VoronoiMesh

Consider a set of random coordinates. pts = SortBy[RandomReal[{-1, 1}, {25, 2}], {First, Last}]; and find it's VoronoiMesh, <...
66 views

### On automorphisms

I'm using the 9.0 version and I'm trying to compute automorphism groups of graphs, but when I type GraphAutomorphismGroup[G], I just get the same as output GraphAutomorphismGroup, even if I load the ...
57 views

### Custom layered graph layout

I'd like to write a program to draw a graph taking as an input the size of the layers and the edges of the graph. e.g. For edges={} and Layers={3,3,5,1} I'd expect something like this I've used this ...
885 views

### Creating hexagonal grid (hexagonal grid graph)

Is there a function that can create hexagonal grid? We have square grid graph, where we can specify m*n dimensions: ...
75 views

### From graph to time series

Let's consider the time series: ...
72 views

### How to reverse the arrows in a graph?

I have a directed graph for which I want to reverse the direction of the arrows (not the direction of edges). I don't want to use ReverseGraph because it changes ...
85 views

### Issue while evaluating Mathematica expressions from Python [closed]

This is a follow up to my question posted here I am trying to run the code posted here as an answer in the above-mentioned link here from Python I tried, ...
47 views

### Generate an example of a random planar network using MeshConnectivityGraph and DelaunayMesh

I have seen other people run the following code: MeshConnectivityGraph[DelaunayMesh[RandomPoint[Disk[], 1000]]] To generate a planar network (working towards ...
137 views

### Node editor and visual programming

Node editors are all the rage especially in image processing pipelines and shader programming in game engines. For example, here's a stackoverflow question about implementing a Blender-like node ...
69 views

### How to draw Toeplitz graph in Mathematica?

My trials are GraphData["ToeplitzGraph"] GraphData::notdef: GraphData has no value associated with the specified argument(s). and web search, in ...
43 views

### Minimum spanning tree with weighted edges in the adjacency matrix [closed]

I have the following graph with weight on the edges: With the following code ...
193 views

### Optimizing the edge lengths of a graph

This is a follow up to my question posted here The following code scales the edge lengths of a graph to be equal to edge weights ...
36 views

### Generate all possible lists of vertices of a specific size

I am trying to determine if a graph G remains connected after deleting 5 vertices with their neighbors. For example, here I deleted the vertices 1,2,3,24 and 58 with their neighbors. ...
30 views

### How to change graph vertex color without having to manually input each vertex change? [closed]

Using the following code I can create a graph which is just a visual depiction of SA. ...
57 views

### How to replace VertexLabels in NearestNeighborGraph[] with a tailor-made vertex names

Vertex names in NearestNeighborGraph[] are coordinates of undirected graph. I like to replace the vertex names with my own list ...
88 views

### How to change vertex color and vertex size at the same time of Graph

How to change color and size at the same time of some vertices of a graph? I am trying to do it more than an hour but nothing seems to work. I can do it either for color or for size but not both at ...
81 views

### Intuitive visual illustration of wrapping percolation criterion

Context: When studying percolation in finite sized systems, there exist various definitions and criteria for determining when a given system is percolating, i.e. it contains a spanning connected ...
118 views

### Find clusters of positive correlations

I have a square matrix that shows relationships between 71 plants: 1 is a positive, -1 is negative, 0 is inconclusive and blanks are unknown: I would like find the largest groups of plants that only ...
85 views

### Nonrepetitive representation of a group of lists (with sharing members)

Background: Lets first construct a square graph (the ha and second points define to implement periodic boundary condition): ...
165 views

### How to convert a weighted, directed graph into a discrete Markov transition matrix

Suppose that I have matrix matT1 at time t and matT2 at time t+1: ...
96 views

### Graph3D - replace vertices with MoleculePlot3D

How can we replace the vertices in a 3-dim graph with individual Graphics3D objects? In my concrete case I want to visualize a chemical network and replace vertices ...
122 views

### How to draw a Graph in Mathematica and obtain the adjacency list

Is it possible to interactively draw a Graph in Mathematica and obtain the adjacency list? Ideally, I'd like to be able to draw different styles of lines. By interactively, I mean to add nodes and ...
259 views

### Using the Wolfram language to interpret the Wolfram language?

I want to plot the relationship of all fucntions in Mathematica, maybe using Graph or force-directed-graph in D3.js ...
292 views

### Glowing weighted graph (network): vertices and edges

I am trying to find a way (desirably simple and performance/speed optimized for larger graphs) to do the following : Styling graph vertexes by glow-effect and its intensity depending on ...
53 views

### Detect the current PerformanceGoal in EdgeShapeFunction, as a condition for using DynamicLocation

The use of DynamicLocation is described in answers to the following questions: DynamicLocation usage Framework behind Graph plots. DynamicNamespace and friends How ...
26 views

### Given a plot of a network Graph[] how can the {x,y} screen coordinates be output?

Is there a general way to get the screen or "world" coordinates for every vertex in the graphic output of something like this? ...
100 views

### Visualizing and analyzing a large bidirectional graph from adjacency matrix

I have some data from simulations of neuronal synapses in the brain which I would like to analyze, and if possible visualize, using Mathematica. By analyzing I mean obtaining the clustering ...
237 views

### How to simulate a cellular automaton on a network?

Unfortunately, I have not yet understood the Neural Network well. Suppose there is simple network (like Kauffman automata): several nodes that can only be in states 1-0, connections between them, and ...
30 views

### How to fix EdgeWeights when a vertex is deleted from a directed graph (BUG?)

I have the following Codes (developed by @Mr.Wizard and @kglr, respectively): ...
45 views

### Computing the set of automorphisms of a non-simple AND multi-graph?

As the title says, we would like to compute the set of all isomorphisms between, possibly, non-simple directed multi-graphs. A related question is How to compute the automorphisms of graphs with ...
96 views

### Sum of a path on a graph

I need to take my graph: ...
274 views

### How to choose the shortest route? (Vehicle routing problem)

This question is about a small instance of the classical vehicle routing problem (VRP). Someone needs to start from home and complete the three tasks of going to the post office to send a letter, ...
40 views

### difference between unconditional and conditional community graphs

With this question, I like to know the difference between the community structure of an unconditional directed graph and a ...
74 views

### Visualisation of edges values on weight network [closed]

I have a problem when I want to see values of edges on my weight graph. ...
20 views

### Scaling the edge length of a graph to be equal to edge weight for 3D graphs

This is a follow up to my previous post here The following is the solution provided here to set the edge length of a graph equal to the edge weights for a 2D graph posted in the previous post. The ...
61 views

### Scaling the edge length of a graph to be equal to edge weight (again)

This is a follow up to my previous question posted here The following is an excerpt of the solution provided here to set the edge length of a graph equal to the edge weights ...