Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

4
votes
1answer
40 views

Associate vertex coordinates and labels

This sounds easy (in which case I will delete my question) and maybe I am getting a bit tired, but I can't find an easy way to create a list from an automatically-generated graph where vertices labels ...
1
vote
0answers
30 views

How to get a directed graph of size N which is also a connected component?

I need to get graphs of size N, in which the whole graph is a connected component. In particular, I'm working with a Albert-Barabasi distribution, with k=2, and random directed edges. Right now I'm ...
1
vote
1answer
60 views

Reap and sow for BreadthFirstSearch

The following Code highlights the breadth-first scan tree ...
3
votes
3answers
114 views

Displaying two items in a graph's edge labels

Is it possible to have double edge labels displayed by a graph? I tried EdgeLabels -> {Placed["Index", 0.5], Placed["Name", 0.25]} but it didn't work.
0
votes
0answers
15 views

Directed graph, immediate predecessor of a vertex [duplicate]

In a directed graph, how do you determine all incoming neighbors of a vertex? For the graph {1 -> 2, 0 -> 2, 2 ->3} the incoming neighbors of 2 should 1 and 0. I checked out AdjacencyList. This works ...
5
votes
2answers
58 views

Counting the number of unconnected subgraphs

If I have a Graph, how can I count how many disconnected pieces it has? Mathematica must know this since it is able to separate them out when it displays the graph, ...
6
votes
2answers
341 views

Branching points detection in processed image

I want to get the branching coordinates from a computer-generated image like this one: After SkeletonTransform and Pruning, I ...
1
vote
0answers
37 views

CommunityGraphPlot of weighted graph: node too far

I am playing with weighted Graph and CommunityGraphPlot, and I am considering the following example. ...
1
vote
2answers
41 views

Infix notation for VertexLabels in a Graph (reformulated from a closed topic)

I am reformulating this question as it was incomplete. I want to label vertices in a graph with expressions in infix notation. I copy my code below. First part converts a list of expressions to ...
4
votes
1answer
54 views

Plotting a graph with its vertices on a circle

If have the following code. AdjacencyGraph[Table[Boole[CoprimeQ[i - j, 8]], {j, 0, 7}, {i, 0, 7}]] This generates a graph with 8 vertices. If the vertices are ...
3
votes
0answers
67 views

Hopcroft's Algorithm for Minimization of Deterministic Finite State Automaton

Background Given a deterministic finite state automaton, Hopcroft's algorithm is a $O(n \log(n))$ algorithm for finding an automaton that generates the same language with a minimal number of vertices....
5
votes
2answers
144 views

Separating disjoint sub-Graphs

Background: I am comparing the financial data from some 60 hospitals in The Netherlands over 2012 - 2017. The data are public, but need to be curated manually, as e.g. some hospitals have merged, some ...
2
votes
1answer
49 views

What is substitute for HighlightCentrality? [closed]

I have a graph that has determined the Betweenness Centrality value for each vertex. I want to visualize the difference in the centrality value on the graph. Based on the documentation we can do it ...
7
votes
1answer
350 views

Graph-like info-graphics

The Sunday, January 27, 2019 New York Times has a superb info-graphic describing the path from citizen to Member of the House of Representatives for the current members, including steps such as ...
1
vote
0answers
18 views

what replaces MinimumVertexColoring? [duplicate]

It is straightforward to find the chromatic number of a named graph in Mathematica's database of graphs. What is the simplest way to find a coloring of the vertices corresponding to the chromatic ...
1
vote
0answers
36 views

Labeling edges in Graph

I want to make a graph of the mother nuclides of all Tin Isotopes. I found this ...
9
votes
6answers
351 views

Finding the largest rectangular submatrix

I have a sparse non-symmetric binary matrix with a block structure. The dimensions of the matrix are thousands rows and less than one hundred columns. How do I identify the largest non-contiguous ...
1
vote
1answer
36 views

Converting Graph3D to Graphics3D

How you do convert a Graph3D (or GraphPlot3D) into Graphics3D? Graphics3D@ButterflyGraph[3] ...
4
votes
4answers
70 views

Get complete graph from set of vertices?

There is a function in Mathematica called CompleteGraph which takes a number and makes a complete graph with that number of vertices: ...
3
votes
1answer
38 views

Specify input ports with NetGraph for network within a network

I have a network with two input ports ("a" and "b"). I want to use this net within a bigger network. The problem is that I cannot find a syntax to specify to which input port the previous layers of ...
4
votes
1answer
58 views

Using TeXForms as vertices of a Graph

I have a set of equations written in TeX that I want to use as vertices of a graph, with edge labels showing how the equations are connected. I read the equations in from a file, then replace any ...
4
votes
1answer
43 views

Mathematica package to calculate the graph crossing number

I have been searching for a mathematica package that can calculate the graph Crossing number of a (small) given arbitrary graph (the graphdata of known graphs doesn't help me). Before I write my own ...
3
votes
1answer
67 views

Trim graph to fully connected components?

Given a graph like e.g., ...
1
vote
0answers
68 views

How can we make an algorithm with the A* method in Mathematica with 5 different flight routes? [duplicate]

I need to find the shortest path with the A* algorithm using Mathematica. I have 5 different flight routes with coordinates. They start and end at the same point. Between every point there is a wind ...
22
votes
3answers
970 views

How can I make a graph network from image of granular packing?

I have an image from experimental data of granular packing. I need to characterize the packing as a network. The network consist of node (center of granular particle) and edge. Two node are connected ...
3
votes
1answer
65 views

Customising GraphPlot

I am trying to get GraphPlot to order the nodes always in the same way. Unfortunately the graph spec (set of rules defining the connectivity) seems to override the <...
1
vote
0answers
54 views

Decay chain browser

This https://demonstrations.wolfram.com/IsotopeBrowser/ used to be an excellent tool to demonstrate decay chains to my students. Unfortunately it does not work under newer versions of mma. Can anybody ...
4
votes
1answer
78 views

Highlight all paths in a graph below some threshold length

I have a weighted graph, for example, a random geometric graph within a square domain $[-1/2,1/2]^2$, with a node fixed at the origin. How do I use HighlightGraph to show all paths which start at the ...
2
votes
1answer
36 views

Version 9 - delete edge from Delaunay Graph

I have a problem with subgraph in Mathematica 9. In Ver10 the below code works : ...
2
votes
3answers
74 views

How can I compute the chromatic number of a graph?

I'm starting in Wolfram Mathematica. I saw that MinimumVertexColoring [g] could be used to calculate the chromatic number of a graph, but ...
5
votes
1answer
85 views

Why Does GraphPlot mislabel Vertices from a Graph?

A very peculiar thing is happening when I wrap a Graph with GraphPlot. The picture below shows the correct vertex labeling. However, GraphPlot changes the vertex labeling! Am I misusing this function ...
2
votes
2answers
37 views

Extract EdgeList From Non-Square Matrix

Given a non-square 3x10 matrix like below, is there a way to extract the implied EdgeList from it. For example, the Edgelist from the below matrix would be S1->F1, S1->F5,S1->F9, S2->F9,S3->F1,S3->F9 ...
9
votes
4answers
543 views

How to remove vertices from a graph?

I have 2 lists: list 1 is a list of vertices of a graph, says, {1,2,3,4,5} and list 2 keeps track of edges (i.e which vertex connects to which) such as {{1,2}, {2,3},{3,4},{4,1},{2,5}}. Now I want to ...
9
votes
1answer
243 views

How to color each edge of a graph with two colors?

This is a chord visualization taken from here. The corresponding code for visualization is ...
0
votes
0answers
33 views

How to form clusters from adjacency matrix and node weights?

Let us consider a binary adjacency matrix $M$. Lets us also consider that each node has a weight. I want to form clusters (with given cluster size, for example, 6 nodes in each cluster) where the ...
0
votes
2answers
52 views

Problem with FindShortestTour function

I'm new to Mathematica but I've read some documentation and guides and, unfortunately, haven't found a solution. There's the following matrix in the task: And I have to solve this TSP problem ...
1
vote
1answer
42 views

Calculation of non-overlapping set (ordering set ) of minimum spanning trees

I am interested in calculating a set of non-overlapping minimum spanning trees of a weighted graph. For example to calculate the set of size 3. I calculate the maximum spanning tree, remove its edges ...
0
votes
1answer
45 views

Program to delete node/vertex from graph having out degree zero

Program to delete a node from graph having out degree zero. Consider the following graph where M -no. of edge, N-no. of vertices, (u,v) edge. M=6, N=6 1 2 1 3 1 6 2 3 3 4 3 5. I want to delete 6, 5 &...
1
vote
1answer
130 views

How to derive the graph of any n-step transitions through a Markov chain

Context: The code below produces the graph of a Markov chain with the transition probabilities shown on each edge. If I chose any vertex to start from, say vertex 1, I would then like the graph of all ...
1
vote
1answer
44 views

Graph: absolute vertex size

How can I set absolute vertex sizes in Graph, so that the vertex size on screen (number of pixels or printer's points) is invariant to changes in the option ...
1
vote
1answer
38 views

How to find efficiently the independent vertex sets from a large adjacency matrix?

I have a binary adjacency matrix $M$ of size $72\times 72$. I would like to find all possible combinations of 18 non-adjacent nodes. There are $^{72}C_{18}$ possible (adjacent and non-adjacenct) ...
7
votes
2answers
323 views

How to color nodes in a adjacency graph with different colors?

Let us consider a binary adjacency matrix $M$. We want to color the nodes of corresponding adjacency graph with 4 different colors such that two adjacent nodes have different colors. How to find 4 ...
20
votes
1answer
538 views

Generating and rendering extremely large graphs

I'm interested in generating and rendering extremely large graphs, i.e., ones having $10^6 \to 10^8$ vertices. (These graphs will ultimately be rendered in PDF or PNG and printed on large, poster-...
3
votes
3answers
92 views

Why Graph does not recognize chains of vertexes like NetGraph

Cross posted on Wolfram Community. Perfect logic: NetGraph[{1, 1, 1}, {1 -> 2 -> 3}] But this does not make sense: ...
29
votes
5answers
1k views

Elegant implementation of factorial tree graph

Consider the tree graph used in part of my solution to this question: Each level $i$ has $i!$ nodes, and the branching ratio is $i+1$: I kludged together code to generate this graph (with code ...
3
votes
1answer
64 views

How to change node color in .dot file using pattern matching?

For example I have a dot file that describe a decision tree or binary tree In the file, the color of node is always gold, so I try to change it according the number in ...
0
votes
0answers
30 views

Recursive function call in Fold: $RecursionLimit issue

I'm trying to generate a list of all local complements of a graph $G$. A local graph complement $G\star v$ for $v\in V$ is defined as taking the neighbourhood of the vertex $v$, and flipping the ...
5
votes
1answer
84 views

Automatically avoid overlapping labels and edges?

How can I automatically avoid vertex labels overlapping with edges? ...
0
votes
1answer
24 views

Cut graph at a given edge and return remaining subgraphs?

I would like to have a function that removes an edge from a graph and returns all remaining graphs after the operation. For example for a graph like ...
1
vote
0answers
28 views

How to form sets of non-adjacent subgraphs from all possible subgraphs and the adjacency matrix?

I have connected graph with $72$ nodes. The binary adjacency matrix of the connected graph is $A$. The size of $A$ is $72\times 72$ and its symmetric. I have generated all possible subgraphs ($17000$...