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

Strange Vertex Size Problem when Moving From 999 to 1000 Verteces

I have a problem with Graph plot scaling of vertex sizes when I go from 999 vertices to 1000 vertices. The following code scales the vertex size properly when the numNodes = 999; but not numNodes = ...
user avatar
2 votes
2 answers
188 views

Restores a difficult digraph

I want to reconstruct this picture,like this: I have do some work,this is my code ...
user avatar
2 votes
1 answer
47 views

Adding an edge between G1 vx and G2 vy?

I have two random graphs G1 and G2 that I want to join with an edge from a particular vertex vx in G1 to a particular vertex vy in G2. I can't find a way to do it. Here is my latest code: ...
user avatar
10 votes
1 answer
366 views

Can Mathematica read planar graphs with pc format?

We can download files about some special planar graphs at the following website, but their files are suffixed with pc. http://users.cecs.anu.edu.au/~bdm/data/planegraphs.html I don't know how to ...
user avatar
  • 763
5 votes
1 answer
163 views

Finding connected components in 2D integer coordinate system

Let L be a finite set of pair of integers. I want to partition L according to connectivity The connectivity is intuitive : Rule1 ...
user avatar
  • 2,835
-2 votes
1 answer
86 views

Could a function such as Slot be used in this genetic code analysis? [closed]

...
user avatar
  • 573
1 vote
1 answer
60 views

NestGraph Basics

Summary How does NestGraph build a graph? Example Column[NestList[{2 #, 2 # + 1} &, 0, 2]] 0 {0, 1} {{0, 2}, {1, 3}} Now NestGraph[{2 #, 2 # + 1} &, 0, 2, ...
user avatar
  • 41
3 votes
0 answers
48 views

Mathematica failing to export consistent layout

Mathematica is a great tool but when it comes to layout generation is quite poorly intuitive: I would love that exporting to images and SVGs could be more friendly and compliant with graphic design ...
user avatar
2 votes
1 answer
98 views

Can you count the number of self-loops per vertex in a graph?

In this graph, such output would be: 0 self-loops for vertex w, 1 self-loop for vertex c, 6 self-loops for vertex ...
user avatar
  • 573
2 votes
0 answers
77 views

Need some Graph Invariant Computations

I have found a list of graph invariants at the house of graphs (HOG) here. I am able to compute almost all of them with Mathematica and IGraph/M. I am missing computations for the following: Genus, ...
user avatar
1 vote
1 answer
78 views

GraphUnion in Mathematica 12 vs 13

In Mathematica 13, GraphUnion[g] returns g. In Mathematica 12, in what I can only think is a bug, the same code returns ...
user avatar
  • 203
2 votes
1 answer
85 views

Calculating distance between a set of random points in hyperbolic space

Given the metric of the Poincaré upper half-plane model $$(ds)^2 = \frac{(dx)^2 + (dy)^2}{y^2}$$ and two known points $(x_1, y_1)$ and $(x_2, y_2)$ in the corresponding hyperbolic space $\mathbb{H} = \...
user avatar
  • 1,589
2 votes
1 answer
49 views

CommunityGraphPlot colors the communites automatically. Is it possible to access a list of those colors, ordered by community?

I have some code (see below) that takes a large graph and recursively coarse-grains it by modular community structure. Each step takes a graph as input, detects its communities, coarse-grains the ...
user avatar
4 votes
1 answer
86 views

How to get a plane drawing according to the rotation system given

A rotation system is an ordering of neighbours around each vertex that defines a particular embedding of the graph in the plane. For example, below is the rotation system of a plane graph. ...
user avatar
  • 763
3 votes
1 answer
53 views

GraphDiameter for molecule graphs error [closed]

I was looking into GraphDiameter for molecules and ended up on this [page][1], which gives examples in various modalities to calculate the graph diameter for this molecule.'CC(C)C(C(=O)NC(=O)C1CCCN1C(=...
user avatar
  • 535
2 votes
1 answer
44 views

IGFaces gives weird result

I'm using the IGraph/M package to perform some calculations on graphs. Specifically, I want to use IGFaces to determine how many edges/vertices each face has for ...
user avatar
6 votes
3 answers
387 views

How to detect chains (sequence of degree 2 vertices ) in a graph?

I am interested in finding the positions of "chains" (sequences of vertex degree 2 vertices) in a graph. I plan on collapsing these chains later to vertices with labels indicating that they ...
user avatar
7 votes
3 answers
588 views

How can I quickly find the coordinates of key points? [closed]

There are 1000 points in the space. The coordinates are (0,0,0) - (9,9,9). Any point can cover all points on the three straight lines (parallel to the X, Y and Z axes respectively) where this point is ...
user avatar
  • 301
-2 votes
2 answers
150 views

Random graphs in Poincare disk

The question is inspired by that article ( see Wiki as a first reading on the topic). This is an actual topic of modern mathematical physics. Here is my (partly successful) attempt to implement such ...
user avatar
  • 17.1k
2 votes
1 answer
84 views

Retrieve flows for a given maximum bipartite graph matching

I have a graph and we can use FindMaximumFlow to find the maximum amount of pairings in such a graph. But I want to know the actual paths as well, not just the maximum amount of them. For instance: ...
user avatar
4 votes
1 answer
111 views

Wish more readable information from IsomorphicGraphQ

In graph theory, an isomorphism of graphs $G$ and $H$ is a bijection between the vertex sets of $G$ and $H$ ${\displaystyle f\colon V(G)\to V(H)}$ such that any two vertices $u$ and $v$ of $G$ are ...
user avatar
  • 763
-1 votes
1 answer
62 views

Help with equation within adjacency matrix

(Value R seen within desired matrix equation) resistance = 0.5; (L = ???) identitymat = IdentityMatrix[30]; fullmatrix = ((AdjacencyMatrix[plot])) + identitymat // MatrixForm p.s. I believe I have ...
user avatar
2 votes
2 answers
103 views

Calculating Information centrality for complex network

I want to add the information centrality metric to my analysis of complex network. Is there any in built function or library that I can use in mathematical. I did not come across any algorithm with ...
user avatar
1 vote
1 answer
71 views

Why does Mathematica compute zero centrality scores for these weighted adjacency matrices?

The adjacency matrix with weights on each edges are as shown below. ...
user avatar
0 votes
0 answers
40 views

Stray points plotted when using HighlightGraph to visualize DegreeCentrality

When I use HighlightGraph to visualize the directed edges of a digraph and its DegreeCentrality, stray points are plotted which ...
user avatar
  • 5,171
4 votes
2 answers
172 views

How to check if points lie within a circle

So we have two graphs overlapping with the Show[] function, one is a network of connected points, and the other displays three circles over the top of the points. I'm trying to check which points lie ...
user avatar
2 votes
1 answer
108 views

How to draw a cycle graph of a group?

MMA can plot a Cayley graph by CayleyGraph directly, which can help us to visualize the group: ...
user avatar
  • 23.7k
3 votes
3 answers
96 views

How to Derive the Edge List From Adjacency Matrix with Given Row/Col Headers

I've written the following code. It correctly is deriving the edge list from the matrix but it is by row # and col # instead of row name and column name. My questions are (1) how can I add the row and ...
user avatar
  • 1,039
2 votes
2 answers
115 views

Animated contour plots inside multiple shapes

I am new to Mathematica and have recently been trying to investigate solar weather on power grids. I have managed to plot the power grid being studied where the vertices are substations and would like ...
user avatar
1 vote
0 answers
38 views

Comparing task completion using Graphs and Adjacency Matrices

I would like to compare sequences of tasks completed using Graph and AdjacencyMatrix. I have included an MWE for the readers' ...
user avatar
  • 5,171
1 vote
1 answer
71 views

Selecting edges for a random geometric graph in an arbitrarily shaped domain

I have some code to generate a random geometric graph in a domain of specificed shape (here an H-shape). Edges cannot exist when they intersect the domain boundary (so we need line of sight for edges ...
user avatar
  • 1,589
0 votes
1 answer
47 views

How to plot a set-valued mapping graph

I know that if $T$ is a single-valued mapping for example $T(x)=x^{2}$ for all $x\in[0,1]$ then its graph can be plot using Plot[x^2, {x, 0, 1}] Is there any way ...
user avatar
  • 169
1 vote
2 answers
57 views

Converting Combinatorica graph to standard graph type

I'm trying to count triangles in random d-regular graphs. Combinatorica has a function RegularGraph, which gives me the random graph and IGraphM has a function <...
user avatar
  • 21
2 votes
0 answers
124 views

How to calculate the path covering number of a graph?

The path covering number of a graph $G$ is the minimum number of vertex-disjoint paths that cover the vertices of $G$. I am searching for a mathematica package that can calculate path covering number ...
user avatar
  • 763
9 votes
3 answers
333 views

How do you get a whole, outward spitting curved edge in graph?

I don't very like the straight edge like ...
user avatar
  • 23.7k
6 votes
1 answer
71 views

How to hightlight CayleyGraph?

...
user avatar
  • 23.7k
4 votes
2 answers
186 views

Speeding up the Kuramoto model on a random graph

I am solving the Kuramoto model on a random graph $G(n,p)$, plotting the synchrony against the coupling parameter, as follows, ...
user avatar
  • 1,589
0 votes
1 answer
89 views

How to Compute the All Pairs Shortest Paths: Betweenness Centrality of an Edge e [closed]

By definition, betweenness centrality of an edge e is the sum of the fraction of all-pairs shortest paths that pass through edge e. Traditionally, a(s,t) is the number of shortest (s,t)-paths and a(s,...
user avatar
  • 1,039
9 votes
1 answer
251 views

Solving Hashi in graph theory

Today's (April 3, 2022) New York Times magazine has a new class of puzzle, HASHI, by Prasanna Seshadri: "Connect the islands (the circles with numbers) with as many bridges as specified by the ...
user avatar
3 votes
0 answers
146 views

Is it possible to define substitution rules on edges instead of nodes [Wolfram Physics]?

I have a small question about the way substitutions work in the Wolfram Physics project, which might be a general question about how to add edges between nodes and edges. Running a Wolfram Physics ...
user avatar
  • 1,313
5 votes
2 answers
178 views

How can I get Scaled within Inset to overlay Rectangle correctly?

Consider the following graph: ...
user avatar
  • 4,697
16 votes
5 answers
2k views

List all homeomorphically distinct irreducible connected simple acyclic graphs of size 10 ("Good Will Hunting" problem)

In the movie Good Will Hunting the opening math problem is: Display all homeomorphically distinct irreducible connected simple acyclic graphs (trees) of size $n =10$ Recall that a tree (acyclic ...
user avatar
0 votes
1 answer
50 views

Spanning Subgraphs of random sizes with probabilities on edges

I need a way of taking some graph G and obtaining a spanning subset of G where each edge $e_i$ has some probability $P_i$ of being in the subgraph. So the size of the edge sets of each random subgraph ...
user avatar
2 votes
0 answers
34 views

Count all embeddings of a geometric graph on the unit square that preserve all angles between existing edges

If I have a geometric graph with $n$ vertices in the unit square, is it possible to count all embeddings of the graph on the unit square that preserve angles between the existing edges? It would ...
user avatar
  • 1,589
3 votes
2 answers
63 views

Specifying Graph Edges Should Not Overlap Vertices

In the options for GraphPlot and related functions, it seems EdgeShapeFunction overwrites a ...
user avatar
3 votes
2 answers
62 views

VertexLabels not inherited by edges?

I'd like to custom name the vertices of a (complete) graph and have those names reflected in the edges. shiftGraph produces a complete graph with vertices labels from imin to imax. ...
user avatar
  • 349
2 votes
0 answers
52 views

Reproducing Graph functionality from Combinatorica using GraphData (ListGraphs, NumberOfGraphs) [duplicate]

I want to generate graphs with n vertices and e edges, and I also want the ability to count the number of non-isomorphic graphs ...
user avatar
  • 558
1 vote
1 answer
70 views

Path of Least Resistance Minimization Problem

I'm trying to find a path of least resistance using a matrix c of resistance and a given exogenous vector kOne of the total least resistance from point(n) to point(4) (the destination): ...
user avatar
1 vote
0 answers
39 views

Enumerating labeled graphs on n vertices

I'm trying to enumerate the labeled graphs on $n$ vertices having at most $e$ edges. I thought GraphData /@ GraphData[n] and then filtering by edge count would do ...
user avatar
  • 21
9 votes
3 answers
677 views

Faster determination if two nodes are connected in a graph

In the code below connectedQ[g_,v1_,v2_] is a function to check if two nodes v1 and v2 in ...
user avatar
  • 1,892

1
2 3 4 5
39