## Graphs and Networks – Bug in NearestNeighborGraph

To update

Not fixed in 12.0.

`NearestNeighborGraph` Generates an incorrectly formatted output with rastered inputs. Reported to Wolfram Support. CASE: 4093797

``````\$Version
(* "11.3.0 for Mac OS X x86 (64-bit) (March 7, 2018)" *)

NearestNeighborGraph(
Rasterize(Style(#, 20), "Image") & /@ Alphabet(),
2,
VertexLabels -> "Name"
)
`````` The labels are too big.

Is there a workaround?

Posted on Categories Articles

## Generalization of Menger's theorem to infinite graphs

Aharoni and Berger generalized Menger's theorem to infinite graphs: for every digraph and subset A and B, there is a family F of disjoint paths from A to B and a set separating B from A and from a vertex of each path in F consists.

But what I need is a criterion (at least one useful enough condition) that tells me when there is a family of non-contiguous paths from A to B covering all A's 3 vertices.) What's Known?

Posted on Categories Articles

## graphs – Find a partition with maximum number of edges between sets

Is there an algorithm for a given graph (such as an adjacency list) to find a vertex partition that maximizes the number of edges between the two groups of the partition?

For example, for the following set of edges of a diagram with the vertex set $${1, 2, 3, 4, 5, 6 }$$:
$${(1, 2), (2, 3), (3, 1), (4, 5), (5, 6), (6, 4) }$$A possible "maximum" partition is $${ {1, 3, 4, 6 }, {2, 5 } }$$ With $$4$$ Edges between the sentences $${1, 3, 4, 6 }$$ and $${2, 5 }$$,

Posted on Categories Articles

## Forward edges in undirected graphs with FSO

Introduction to Algorithm Books claims that BFS classifies an edge for an undirected graph only as a tree or cross edge. But how about this simple example below, in which, of course, front edges occur?

Given graph with only 2 vertices A and B and 3 edges from A to B!

## Exploration of adjacent vertices

(1) A-> B (tree edge, A is now marked as ancestor for B and B is A's offspring)

(2) A-> B (leading edge? B has not been edited yet (gray) and we have found an edge from his ancestor (A))

(3) A-> B-forward edge with the same reason as in (2)!

What do I miss here?

## Graphs – how to prove the correctness of this BFS algorithm?

I wrote the following algorithm based on BFS. The algorithm detects if a given undirected connected graph contains a cycle. If he contains a cycle, he prints it out. I'm pretty sure it works well, but I do not really know how to prove it right.
Here is the pseudocode:

``````Let s be the root
set parent(s)=s and parent(v)=null for all other v
create queue q ;
enqueue(s,q);
cycle=false;
while (!isEmpty(q) && !cycle) {
u=front(q);
for every edge (u,v) incident to u {
if (parent(v)!=null){
parent(v)=u;
enqueue(v);
}
else if (parent(u)!=v){
cycle=true;
keep the edge (u,v)
}
dequeue(q);
if (cycle){
print edge (u,v)
while (parent(u)!=parent(v))&& (parent(v)!=u)&&(parent(u)!=v){
print edge (u,parent(u)) and  edge (v,parent(v))
u=parent(u);
v=parent(v);
}
if (parent(u)==parent(v))
print edge (u,parent(u)) and edge (v,parent(v))
else
print edge (u,v)
}
/**************************************************/
/**************************************************/
``````

I worked on the proof, but I can not get it.
First, I want to prove that the algorithm detects a cycle if G contains it.
My idea is the following:
Let us be the root of the FSO. We know that G contains a cycle, so there is a node, so there are two different paths from s to such a node. Let u be the first node to fulfill this.
Since this BFS visits all nodes and examines each edge once, and also marks all visited nodes as visited, it reaches a step in which it visits the node u a second time and then finds the cycle.

Then I want to prove that, in the positive case, the edges that are printed form a cycle, but I really stick with it.

Posted on Categories Articles

## Is there any idea of ​​"face" for limited genus graphs?

Is there any idea of ​​"face" for limited genus graphs?

For example, given the fixed genus k, there are some q for which there are q sets of cycles $$S_1, S_2, .., S_q$$ Every G [S_i] is planar. S_i is a subset of areas of G [S_i]. Each cycle of G can be written as a symmetric difference of cycles in $$cup_ {i = 1} ^ q S_i$$?

Posted on Categories Articles

## java – How to write a program to check if two graphs are isomorphic or not. My code accepts the input of two diagrams

``````package net.codejava;

//This is a java program to represent graph as a adjacency matrix
import java.util.Scanner;

{
private final int vertices;

{
vertices = v;
adjacency_matrix = new int(vertices + 1)(vertices + 1);
}

public void makeEdge(int to, int from, int edge)
{
try
{
}
catch (ArrayIndexOutOfBoundsException index)
{
System.out.println("The vertices does not exists");
System.out.println("Both the graphs are not isomorphic");
}
}

public int getEdge(int to, int from)
{
try
{
}
catch (ArrayIndexOutOfBoundsException index)
{
System.out.println("The vertices does not exists");
System.out.println("Both the graphs are not isomorphic");
}
return -1;
}

public static void main(String args())
{
int v, e, count = 1, to = 0, from = 0;
Scanner sc = new Scanner(System.in);
try
{
System.out.println("Enter the number of vertices of Graph 1: ");
v = sc.nextInt();
System.out.println("Enter the number of edges of Graph 1: ");
e = sc.nextInt();

graph = new Represent_Graph_Adjacency_Matrix(v);

System.out.println("Enter the edges:  ");
while (count <= e)
{
to = sc.nextInt();
from = sc.nextInt();

graph.makeEdge(to, from, 1);
count++;
}

System.out.println("The adjacency matrix for the given graph is: ");

for (int i = 1; i <= v; i++)
{
for (int j = 1; j <= v; j++)
System.out.print(graph.getEdge(i, j) + " ");
System.out.println();
}
count=1;

System.out.println("Enter the number of vertices of Graph 2: ");
v = sc.nextInt();
System.out.println("Enter the number of edges of Graph 2: ");
e = sc.nextInt();

graph1 = new Represent_Graph_Adjacency_Matrix(v);

System.out.println("Enter the edges:  ");
while (count <= e)
{
to = sc.nextInt();
from = sc.nextInt();

graph1.makeEdge(to, from, 1);
count++;
}

System.out.println("The adjacency matrix for the given graph is: ");

for (int i = 1; i <= v; i++)
{
for (int j = 1; j <= v; j++)
System.out.print(graph1.getEdge(i, j) + " ");
System.out.println();
}

}
catch (Exception E)
{
System.out.println("Somthing went wrong");
}

sc.close();
}
}
``````

How do I check if the two diagrams are isomorphic or not?
I need it for my homework
And I just want to know the way and I can code it
Can someone help please?

Posted on Categories Articles

## Graphs and Networks – Check if an edge is an element of an edge list

I have a diagram whose edge list is given by

``````edges = {1 (UndirectedEdge) 1, 1 (UndirectedEdge) 2, 1 (UndirectedEdge) 3, 1 (UndirectedEdge) 4, 1 (UndirectedEdge) 5}
``````

I think that the "if" statement

``````If((1 (UndirectedEdge) 1) (Element) edges,1,0)
``````

does not return 1 or even zero as expected. It just spits back the full condition

``````If(1 (UndirectedEdge) 1 (Element) {1 (UndirectedEdge) 1,
1 (UndirectedEdge) 2, 1 (UndirectedEdge) 3,
1 (UndirectedEdge) 4, 1 (UndirectedEdge) 5}, 1, 0)
``````

Why is this happening?

## Algebra Precalculus – Convert between Cartesian and polar equations and their graphs

I am asked to convert $$(x + 2) ^ 2 + y ^ 2 = 4$$ in a polar equation, and then confirm on my calculator. I converted it to $$r = 4cos ( theta)$$but the graphics do not look the same at all. If someone could explain how to check for each answer and why the graphics do not look the same, that would be great.

Posted on Categories Articles

## co.combinatorics – model for random graphs where the number of cliques remains limited

The Erdös-Rényi model works. You just have to take the associated probability $$p$$ scale with the size of the graph $$n$$, For example, sentence 4.13 in Random graphics from Bollobás shows that for ER graph with $$p = p (n)$$ so that
$$np → ∞$$ With $$np = o (n ^ frac {1} {3})$$ as $$n → ∞$$meets the number of cliques $$omega (G (n, p)) = 3$$ with high probability.

Posted on Categories Articles