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
3
votes
1answer
28 views

Annotate graph vertices fails

According to the docs this should work but for some reason does not: g = CompleteGraph[3]; Annotate[{g, 3}, "a" -> 17]; AnnotationValue[{g, 3}, "a"] It ...
0
votes
1answer
21 views

Add tooltip on vertex and show a label of vertex at the same time

Is it possible to have multiple labels appear on one vertex? Let's say I want to show numbers on vertex always, and when I hover over a vertex, I want label to appear as tooltip. Is that possible?
3
votes
1answer
29 views

How do I get specific subgraphs from my adjacency graph/matrix under certain conditions?

I have the following set of code which creates a random symmetric matrix (elements 0 and 1) and a labeled adjacency graph. A 0 corresponds to no edge and a 1 corresponds to an edge. ...
2
votes
1answer
30 views

Linking two strings from list to use for GraphPlot using functions

I was wondering if anyone has an idea how to use Cases or DeleteCases or something similar to get next result: I have a list of strigs: ...
5
votes
1answer
100 views

Determine if the edges of a graph are distinguishable

Mathematica 12.1 introduces edge tagged graph (EdgeTaggedGraph), which is supposed to solve the problem of distinguishability of parallel edges. Unfortunately, the ...
6
votes
2answers
150 views

How do I combine multiple matrices into a single adjacency graph?

I'm sort of new to Mathematica and have been working on a project that involves simulating newtwork changes in the form of matrices. I have the following lines of code: ...
4
votes
1answer
45 views

Generate all spanning trees of the complete graph

How can you use Mathematica to generate all the spanning trees of the complete graph? One can count the spanning trees of a connected graph ${G}$ using e.g. the Tutte polynomial $T_{G}(1,1)$. For the ...
11
votes
1answer
182 views

Extraction of statistics of cracks (craquelure in paintings)

The below image is of the pattern of cracks in the surface of Johannes Vermeer's Girl with a pearl earring, captured using a method called "grazing incidence illumination" (the light is shined at the ...
9
votes
3answers
191 views

VertexContract and contraction of vertices of degree 2

There are several questions that seem close to this, but I haven't found any that are precisely what I need, which is called "path contraction." Consider this graph: ...
2
votes
1answer
33 views

Average behavior of degree distribution plots

I'll show what I'm doing in the moment and after that I'll explain what I'm trying to achieve. I use the following code to generate a large number of Barabási-Albert networks, and after that I plot ...
2
votes
2answers
59 views

Include the edge width of a hand-drawn graph to the respective imported morphological graph

I am still relatively new to Mathematica, but with the great help of this forum I managed to transform a doodled sketch into a graph, see attached file. I have used this code: ...
1
vote
1answer
34 views

Can not customize `VertexLabels` of `NearestNeighborGraph`

I have the following code: ...
3
votes
1answer
52 views

HighlightGraph doesn't work for NearestNeighborGraph

Why doesn't this work? SeedRandom[1] HighlightGraph[NearestNeighborGraph[RandomReal[1, {10, 2}], 2], 1, VertexSize -> 1/2, VertexStyle -> Red] How to make ...
9
votes
2answers
515 views

Turn handdrawn doodles into graph

I have doodled sketches of graphs in JPG format (they roughly look like stick men, in particular the vertices are not shown - they should be where the lines meet) and want to convert them into proper ...
2
votes
1answer
39 views

Add Edge Label to certain edge in a bipartite graph

From https://mathematica.stackexchange.com/a/109436/70384 , I modified the code to display the bipartite graph I want and how do I label my edge with the edge weight by manually specifying it? I use <...
0
votes
0answers
30 views

Run Hungarian Maximum Matching Algorithm with own sets of vertices and show Bipartite Graph

I have come across this demonstration project from https://demonstrations.wolfram.com/TheHungarianMaximumMatchingAlgorithm/ . How can I supply my own sets of vertices as input so the algorithm can ...
0
votes
1answer
79 views

How can I make a list of 3-connected graphs with 100 points

I'm trying to make the list of all 2-connected subcubic graphs with at most N vertices. I tried this code: ...
2
votes
0answers
34 views

How to canonicalize UndirectedEdge with good performance?

When programming with graphs, it is sometimes important that UndirectedEdge[a,b] and UndirectedEdge[b,a] are treated as ...
4
votes
3answers
141 views

Searching for nodes in the network

Let consider the network ('graph'): ...
2
votes
0answers
52 views

Interactive Graph Construction

I'm interested in constructing an interactive GUI graph generator, where I can add and delete vertices and edges. I'm aware of this question, and this is but a quick follow-up to this answer. I would ...
4
votes
2answers
221 views

Closing a Graph

Consider the following graph g I want to "close" it by adding the following edges Alternatively, I would also be happy with something like where I've added four "...
2
votes
1answer
88 views

How to create random graph with certain properties?

My question consists of two parts. How to create a random undirected connected graph s.t. the probability of the event "The degree of a vertex equals k" is equal to $\frac{k^{-\gamma }}{\zeta (\...
6
votes
1answer
76 views

Checking if a Graph forms a Mesh

Given a random graph, I want to define a function MeshGraphQ that tests if the graph is a lattice (or mesh) graph. Here, I don't need the tiling to be regular. ...
2
votes
1answer
45 views

Choosing bounding cycle for plot of planar graph

Is it possible to specify bounding face for drawing a planar embedding of a planar graph? For example, look at the following: ...
8
votes
2answers
561 views

How to visualize a spherical mesh on a squared plane?

I need to visualize the points of a spherical mesh on a squared plane (this question is different than this one, I believe). For instance, let us first generate points ...
6
votes
2answers
64 views

How to know what GraphLayout was used when Method set to Automatic

I was expecting to get the answer to the above by doing either of the following: ...
9
votes
1answer
65 views

Export graph6 issue

I am exporting large lists of graphs to files in graph6 format, using something like Export["somefile.g6",graphList,"Graph6"] but this always starts the file ...
2
votes
3answers
76 views

Extending a graph

I have been able to present the first block of what I want. For this aim I wrote ...
5
votes
1answer
82 views

How to create a custom EdgeShapeFunction whose arrowheads snap to vertices

When using the Graph option PerformanceGoal -> "Quality", the endpoints of edges (arrows) will snap to vertices, no matter ...
3
votes
1answer
161 views

Connecting 2 graphs according to NearestNeighbor and degree distribution

Context and example: Suppose we have 2 graphs $g_1,g_2$ that we connect together by introducing edges between each node of $g_1$ and its corresponding nearest neighbors within the second graph $g_2.$ ...
8
votes
2answers
101 views

Graph Union with Color Properties Kept

Suppose I have generated the two graphs g1 and g2 below in a separate Mathematica notebook with the node colors as shown. I then would like to copy the two graphs into a new Mathematica notebook and ...
3
votes
1answer
52 views

How do I make some edges in a graph invisible?

I have a number of nodes, each with a numeric label and arbitrary connections between these nodes. When I plot the graph I would like nodes similar in value to be colocated as far as possible within ...
2
votes
0answers
44 views

How to show Mathematica full output of a big Graph

I developed a Graph with 100,000 nodes and 402,000 edges. However, I can't see it because the output is truncated: Also, when I try FullForm I get memory error, even with a 32 CPUs, 120GB RAM + 8 ...
1
vote
0answers
37 views

Pattern matching and searching for subgraphs?

I have a large list of graphs where each node has a dictionary. I'd like to query that list like a database, ie. I have a graph and want to find examples that contain it as a subgraph (and where the ...
2
votes
1answer
39 views

Non-induced subgraphs

I would like to construct graphs that are generated by subsets of the graph edges but that are non necessarily induced subgraphs, so to be able to construct a function that returns all spanning ...
0
votes
0answers
44 views

Use Mathematica to draw a tensor-like network

What are the Mathematica ways to draw this seemly delicate figure? Such that we can output a PDF file in the end.
4
votes
0answers
33 views

How to fix the legend and dotted edges in WolframCloud?

Following the problems in my previous question: How to get good images for Graph in Published Notebooks I found a way to fix the aliasing issue, apparently, the ...
0
votes
1answer
26 views

building a graph from table of string records and array of keywords

I have a table of records, each record is about a publication onm some topic, the different colums indicating the title, authors, abstract and so on I made a function searchkeyword[string_] that ...
4
votes
0answers
65 views

How to get good images for Graph in Published Notebooks

Consider the following Graph as an example: ...
0
votes
0answers
44 views

How to find graph data for a path graph

I have recently updated to Mma 12 (from Mma 9). I input: GraphData[{"Path", 5}] and I get: ...
1
vote
1answer
50 views

How can I get Graph edge labels to parallel an edge line or or follow an edge curve?

Edge labels are always rendered horizontally. I would like the label for any straight line edge to be rotated so the bottom of the label's bounding box is coincident with the edge. There was an older ...
2
votes
2answers
41 views

How can I see an image of an edge labeled graph from GraphData?

If I input: g = {"CompleteBipartite", {2, 3}}; {GraphData[g, "LabeledImage"], GraphData[g, "EdgeList"]} then I can see a graph with its vertices labeled. I ...
16
votes
1answer
547 views

Making a graph or network interactively over an image

Given an image, is it possible to manually draw a graph over it? For example, taking the following image: I want to manually pick the vertices and draw the edges in a "Paint-like" manner to get, for ...
6
votes
1answer
215 views

Getting cell edges from a picture

I would like to write a program that, given a picture of an epithelium (2D cell array), for example automatically detects the cell edges and returns the corresponding lattice. Illustratively, ...
5
votes
1answer
78 views

BreadthFirstScan and DepthFirstScan

Recently, I have been playing with the functions BreadthFirstScan and DepthFirstScan. I'm having a hard time understanding the ...
4
votes
2answers
101 views

VoronoiMesh as a Graph

I want to draw the following graph using VoronoiMesh. For example, since ...
6
votes
1answer
131 views

Updating a graph under ODE dynamics (vertex model)

Consider the following graph, which is obtained from a VoronoiMesh ...
5
votes
1answer
68 views

How to label distance information on each edge of a graph

...
2
votes
1answer
83 views

Building matrices of 0’s and 1’s

How would I go about computing the number of ways an nxn matrix of 1’s and 0’s can be made such that every nxm submatrix has more rows containing 1’s than the number of columns m?
4
votes
1answer
485 views

Is this a bug or my mistake?

This: Graph[{1 \[DirectedEdge] 2, 2 \[DirectedEdge] 3, 4 \[DirectedEdge] 1}] AdjacencyMatrix[%] // MatrixForm generates: But, this ...

1
2 3 4 5
32