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
1answer
102 views

Visualizing transitive reduction of the Hasse Diagram of the integer subset lattice

I have a list of sets of integers, forming semi-lattice under inclusion relation. I need to visualize transitive reduction of the semi-lattice's Hasse Diagram. What is a good way to do this in ...
2
votes
0answers
62 views

Find the Schnyder 3-orientation of a plane triangulation graph

In 1990, Schnyder proved that the internal edges of a plane triangulation graph can be oriented such that each internal vertex has exactly three outgoing edges and the vertices of the outer face have ...
10
votes
3answers
141 views

Faster searching for subsets with pairwise conditions

I am looking for a faster way of finding large subsets of lists that obey pairwise conditions. In particular, I'm looking for a large (over 10k) set of quaternary words (i.e. ordered lists) of length ...
4
votes
1answer
69 views

Creating a Graph of related entities with the data from Wikidata

I've a list of Entities from Wikidata ...
0
votes
0answers
31 views

FindClique does not find all cliques? [duplicate]

Consider the following example matrix M ...
2
votes
3answers
121 views

Path finding in Complete Graph [closed]

I have the following Complete Graph with random labels on its edges ...
2
votes
1answer
68 views

How to determine that a plane graph is an Apollonian network

A planar graph $G$ is an Apollonian network if it is isomorphic to $K_3$ or it contains a vertex $v$ of degree $3$ such that $G-v$ is an Apollonian network. Apollonian networks may equivalently be ...
6
votes
2answers
246 views

How can I plot a graph which contains duplicate nodes?

For $n\leq 3$, the following code works as expected: n = 3; NestGraph[# + {1, 3, 5} &, 2, n - 1, VertexLabels -> Automatic] For $n=4$, I want to get a ...
3
votes
0answers
60 views

Are list-valued vertex weights in graphs invalid?

The documentation for VertexWeight clearly states: The weight wi can be any expression. But I cannot seem to set list-valued vertex weights in my graph: ...
12
votes
3answers
417 views

Generating a matrix with specific number of 1's in every row and column

I would like to have a function f(n,k) that generates a random nxn matrix with k elements equal to 1 in each row and column and has an all-zero diagonal, with all other elements equal to 0. In other ...
3
votes
1answer
51 views

How to delete graph edges with specified weights?

I wonder, if it's possible to delete graph edges on the base of their weights. In other words, can patterns in the function EdgeDelete[g,patt] include weights of ...
0
votes
1answer
26 views

Find a subgraph of k vertices where all vertices are connected to all other vertices? [duplicate]

Given a graph g I would like to find a subgraph sg of k vertices in ...
8
votes
2answers
202 views

Is it possible to extract vertices and lines from this image of nonplanar graph?

The recent post was particularly interesting (see Is it possible to extract vertices and lines from this image?), but I found was that method of the comments seemed unreliable when the graph was ...
3
votes
0answers
76 views

How to convert Graph atomic object back into unevaluated expression? [duplicate]

For the purposes of further development of my shortInputForm function, I wish to convert Atomic objects such as Graph into non-...
14
votes
2answers
615 views

Is it possible to extract vertices and lines from this image?

I have the following image Is it possible to extract the lines from this image and then convert those lines to a graph representation? I tried using ImagesLines[] ...
2
votes
0answers
98 views

Counting the number of triangles of a multigraph

I have a graph with some multiple edges. I tried to calculate the number of triangles in it, so I used the new function FindIsomorphicSubgraph of mathematica 13. We get 64 triangles of the graph ...
3
votes
0answers
49 views

Visualising very large poset with thousands of vertices and edges

I wrote the following code for a large poset. It has over 5000 vertices and over 30000 edges. I used the form "Graph[{a <-> b, a <-> c, etc }, VertexCoordinates -> {a -> {0, 0}, ...
1
vote
0answers
55 views

Getting all possible graphs

I have the following code which gives me some random complete graph ...
1
vote
1answer
84 views

How to define some special planar quadrangulations?

I'm going to define some special planar quadrangulations: Let $H_0$ be the $4$-cycle ${v_0v_1v_2v_3v_0}$, let $\phi_0$ be a planar drawing of $H_0$, and let $F^0_1$ and $F^0_2$ be the faces of $\...
0
votes
0answers
52 views

Get depth of vertices in TreeGraph

I want to get the depth of each vertex in a TreeGraph, g. I might convert g into an ...
3
votes
2answers
89 views

Edge labeling of Complete Graph

I have the following code ...
3
votes
1answer
72 views

Precision in Graph methods

It appears that GraphDistance, GraphDistanceMatrix, FindShortestPath, etc. all work with ...
11
votes
3answers
962 views

"Sit for a spell" graph search

The December 12, 2021 New York Times Magazine puzzle section introduced a new type of word search puzzle, called Sit for a spell. It consists of an undirected graph of 13 vertices labelled by English ...
1
vote
2answers
83 views

How can I display a graph with its weights inside the vertices and its labels just outside?

I have the following graph: ...
1
vote
1answer
44 views

How to Control VertexLabels

Is there a way to control the labels of nodes in a graph - that is, suppressing the names of some nodes but showing the names of other nodes? For example, consider the graph: ...
3
votes
0answers
57 views

Sparse6 format broken for multigraphs

There seems to be a bug in Export for the "Sparse6" graph format, when the graph to be exported is a multigraph (i.e. has repeated edges). For example, ...
2
votes
1answer
63 views

Importing an adjacency matrix in CSV (with labels) and drawing a graph (with labels)

I have created an adjacency matrix in CSV with labels. Now I wish to import the matrix data and draw a network graph with labels at the nodes. What code will do that? Here is the same data: ...
4
votes
2answers
104 views

How can I import an image, retrieve vertex point values from the shape, and turn that into a list?

I'm using a github repo about turning point data into an array to then create a mirror. The author used a point picker in mathematica, but I want to automate the process. How can I import my image and ...
1
vote
0answers
57 views

Find path in graph with two conditions

I have directed graph. Each edge has length and price for passing it. I need to find path with the lowest cost that is shorter than N. For example graph is: ...
6
votes
3answers
283 views

Function to remove self loops but preserve multiple edges in Graph

The function SimpleGraph[] removes both self-loops and multiple edges in the same vertices of a Graph. Is there a function that removes self-loops only?
4
votes
2answers
184 views

Knn graph differences: Mathematica and sklearn

I have this data: Data file I made 8-NN graph as follows: ...
0
votes
1answer
35 views

Adjacency Matrix not giving output corresponding to Vertex Labels [duplicate]

Consider the following Graph: g1 = Graph[{1 -> 3, 2 -> 3, 3 -> 4, 4 -> 5, 4 -> 6}, VertexLabels -> "Name"] This gives the following ...
3
votes
1answer
77 views

How to glue some isomorphic graphs to a common vertex or a vertex set

I have some isomorphic graphs (in fact, non-isomorphic graphs are also possible), and I want to glue them to a vertex. (Note that here this vertex is a cut vertex). Strictly speaking, two graphs $G_1$ ...
2
votes
2answers
154 views

How to ask Mathematica to plot a rectangular grid with red points on all crossings?

How can I ask Mathematica to plot a rectangular grid (similar to the attached picture) with those red points on all crossings?
2
votes
1answer
53 views

EdgeContract when vertex names are lists

Graphs often compress a great deal of information into a simple visualizable structure. So it is not uncommon that vertex labels include more information than a simple index. For example, vertex ...
1
vote
0answers
66 views

How to work with structured data using graphs

Given that the functions for not only creating but also modifying Graph are functional programming creating copies it seems to me that it is a good idea to keep the vertices small, such as sticking to ...
3
votes
1answer
111 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
30 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
54 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
29 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 ...
0
votes
1answer
172 views

How to Breakout Edge Betweenness Centrality

Consider the following: ...
1
vote
1answer
29 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
71 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
77 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
93 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
108 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
92 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
241 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
91 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
66 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 ...

1
2 3 4 5
38