## latex – Use TeXForms as vertices of a graph

I have a bunch of equations written in TeX that I want to use as the vertices of a graph, with edge labels showing how the equations are connected. I read the equations from a file and then replace any backslashes with two backslashes. Then I use TeXForm to convert it to Mathematica notation. I'm using the HoldForm option to prevent Mathematica from changing b + a to a + b.
However, when I show the chart, the "HoldForm" seems to be ignored. Here is an example:

``````nodeList = {a, b, c};
edgeList = {a <-> b, b <-> c, c <-> on};
aShape = ToExpression["["["["$$c = \ sqrt {a ^ 2 + b ^ 2}$$", TeXForm, HoldForm];
bShape = ToExpression["["["["$$c = \ sqrt {b ^ 2 + a ^ 2}$$", TeXForm, HoldForm];
cShape = ToExpression["["["["$$\ text {range equals A}$$", TeXForm, HoldForm];
To press["The 3 labels are: ", {aShape, bShape, cShape}];
shapeList = {a -> aShape, b -> bShape, c -> cShape};
g = graph[nodeList, edgeList, VertexShape -> shapeList, VertexSize -> Large]
``````

This is the output:

Notice that b ^ 2 + a ^ 2 appears in the node's display as ^ 2 + b ^ 2. "Area equals A" is also displayed as the product of the three variables "Area", "Equal" and "A".

How can I display the equations without form changes in the nodes of the graph?

## Graph theory – It is possible that the nodes of a network have different total costs. If they have the same value in grade centrality?

I do the same simulations with random networks and for each network and compute different units of measure such as the grade centrality. In the network, more than one node is likely to have the highest degree. I used the adjacency matrix for the calculation.

For these nodes, I calculate the total cost and use the following code.

``````for n = 1: num_nodes
% u is the node with the highest degree
Cost_of_median_tree = cost_of_median_tree + (distanse * weight_of_vertex (u));

The End
``````

This is my results from my simulation of grade centrality:

``````# RC Time_execuson Total_Cost Posision_of_node Time * Cost
0.250000 0.000399 466.000000 59 0.186120
0.250000 0.000399 471.000000 85 0.188117
0.250000 0.000399 461.000000 164 0.184123
0.250000 0.000399 476.000000 189 0.190114
0.250000 0.000399 472.000000 195 0.188516
0.250000 0.000399 477.000000 198 0.190513
``````

No one knows if the nodes have different total costs ???

## How is it possible to place the X-axis in Numbers app at the top of the graph?

I have a vertical line chart and I need to place the x-axis at the top of the chart. How is it possible?
Many Thanks

## Shrink a graph without changing the color number

Does reducing a graph (removing or replacing vertices or edges) have a specific name without changing the color number?

Take this cactus graphic as an example:

The vertices with vertex 1 can be removed without affecting the vertex color number. I think something similar should be possible with cycles, eg. The removal of the two vertices at the bottom of the cactus should not affect its color number.

Are there any polynomial algorithms that do that? I would prefer not to reinvent the wheel.

My goal is to simplify graphics before they are entered into other algorithms.

I will also appreciate references to relevant literature. Many Thanks!

## java – implementation of the generic graph class and dijkstras

I participate in competitive programs and have constantly implemented and redesigned graphics. So I decided to create a reusable Graph class implementation and implement some common methods, including DFS, BFS, and Dijkstras.

Are there any borderline cases my code overlooks? Is there anything I could do to improve it?

``````import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Stack;
import java.util.function.BiConsumer;
import java.util.stream.Collectors;

public class graph {

public class node {
public T-value;
public map Edge;

public node (T-value) {
this.value = value;
edge = new HashMap <> ();
}
}

public list Node;

public int numNodes = 0;
public int numEdges = 0;

public diagram () {
this (wrong);
}

public graph (Boolean random access) {
Node = new ArrayList <> ();
this.directed = directed;
}

}

public void connect (int i, int j, int weight)
node.get (i) .edges.put (j, weight);
if (! directed)
node.get (j) .edges.put (i, weight);
}

The public class DijkstrasNode extends the node {
int dist = -1;
boolean visit = false;
DijkstrasNode previous;

public DijkstrasNode (T-value) {
great value);
}

public DijkstrasNode {node node) {
super (node.value);
this.edges = node.edges;
}
}

public void processBFS (int source, BiConsumer) Consumer) {
queue q = new LinkedList <> ();
boolean[] visited = new Boolean[nodes.size()];
while (! q.isEmpty ()) {
int id = q.poll ();
if (visitedhttps://codereview.stackexchange.com/q/211584)
continue;
Visitedhttps://codereview.stackexchange.com/q/211584 = true;
Node n = node.get (id);
Consumer.accept (n, id);
for (int c: n.edges.keySet ())
}
}

public void processDFS (int source, BiConsumer) Consumer) {
stack q = new batch <> ();
boolean[] visited = new Boolean[nodes.size()];
q.push (source);
while (! q.isEmpty ()) {
int id = q.pop ();
if (visitedhttps://codereview.stackexchange.com/q/211584)
continue;
Visitedhttps://codereview.stackexchange.com/q/211584 = true;
Node n = node.get (id);
Consumer.accept (n, id);
for (int c: n.edges.keySet ())
}
}

public list dijkstras (int source) {
list djk = node.stream (). map (DijkstrasNode :: new) .collect (Collectors.toList ());
djk.get (source) .dist = 0;
priority queue q = new PriorityQueue <> ((i, j) -> i.dist - j.dist);
int visitCount = 0;
while (! q.isEmpty () && visitCount <djk.size ()) {
DijkstrasNode n = q.poll ();
if (n. visited)
continue;
n.visited = true;
visitCount ++;
for (int child: n.edges.keySet ()) {
DijkstrasNode cn = djk.get (child);
if (! cn.visited && (cn.dist == -1 || n.dist + n.edges.get (child) <cn.dist)) {
if (cn.dist! = -1)
remove q (cn);
cn.dist = n.dist + n.edges.get (child);
cn.previous = n;
}
}
}
Return djk;
}

}
``````

## If enabled, add row to the data graph? | Google Sheets

Basically, I have been working on some automated solutions to display the date and data of the last 4 weeks in this data sheet. There are a few more bugs, but the last thing I have to figure out is how to just render the graph checked string (in column i), My goal is to have a dynamic chart and my idea is to find a kind of formula combination to add the data from the columns `D-G` into a separate block of cells below (only if column) `I` is checked). Then I would have a diagram already configured to display the information in that area. However, I can not find a way to do that. Thank you in advance and if there is a better way, as long as it works, that is perfect.

## Chromatic number of a complete graph after removing one or two edges

Is there an easy way to find the chromatic number of a complete graph after one or two arbitrary edges have been removed?

I'm looking for a simple algorithm that could exploit this feature.

## Graph theory – How useful are neural networks for weight change?

Consider the space of feedforward neural networks with a given structure: $$L$$ Layers, $$m$$ Neurons per layer, ReLu activation, input dimension $$d$$Ausgabemaß $$k$$,

Which means I think about the map $$F: mathcal {W} _1 times mathcal {W} _2 times dots times mathcal {W} _L times mathbb {R} ^ d after mathbb {R} ^ k$$, from where $$mathcal {W} _i$$ is the space of possible weights for the shift $$i$$, For the sake of simplicity, we assume that every weight matrix is ​​bounded by a constant $$M$$,
Now let's set the parameters so that we get them $$v = F (W_1, points, W_L, x ^ *) in mathbb {R} ^ k$$ (Note that $$x ^ *$$ is also fixed).

Picture now that I inject a random noise $$eta in mathbb {R} ^ {m times m}$$ in a weight matrix $$W_i$$If the norm of noise is 10% of the norm of the matrix, e.g. $$|| eta || = || W_i || / 10$$ , How does that affect my final output?

which means what is the expected value of $$|| v – v_ * ||$$, from where $$v _ *$$ will the output of the network be received after the slight change of the weight description?

## Algorithm – Find all the ways to go through a graph that meets certain criteria

TL; DR I need to find all ways to go through an undirected cyclic, possibly unconnected graph to find all groups of connected nodes that meet certain criteria.

There is a diagram of nodes, where each node is assigned a value and the edges represent compatible nodes.

Compatible nodes can be grouped together, but only if each node is compatible with all others. For example the following diagram, shown as adjunct list:

``````0: 2, 3
1:
2: 0, 4, 6, 7
3: 0, 4, 6, 7
4: 2, 3, 5, 6
5: 4, 7
6: 2, 3, 4, 6
7: 2, 3, 5, 6
``````

Nodes {4, 5} can together form a group, as well as nodes {3, 4, 6}, while Node 1 can only form a single set of elements.

Now that each node contains a value, you will find n sets with the highest combined value. For the above example, if the nodes have the following values:

``````0: 4
1: 6
2: 4
3: 5
4: 6
5: 3
6: 3
7: 5
``````

The solution for n = 2 are the sets {3, 4, 6} and {2, 7} with a combined value of 23.

The approach I've started is to use a modified version of DFS that only populates the stack with the nodes that are compatible with all the nodes in the current set. If there are no such nodes, we create a new set and continue with the nodes that have not yet been visited.

Pseudocode:

``````// As long as we have unvisited nodes
while (visit.contains (false))
{
// Take the first unattached knot and put it on a pile
stack.push (find_first (visited, wrong));

// Modified DFS
while (! stack.empty ())
{
Node n = stack.pop ();

// add the node to the set (this is always either the first or the compatible node)

// Find all compatible nodes by finding the intersection of the node's node score list
compatibleNodes = find_all_compatible_nodes (set);

// Add the first compatible unvisited node we find to the stack
for (c: compatibleNodes)
{
if (! visited[c])
{
stack.push (c);
Visited[c] = true;

break;
}
}

}

// If we no longer have compatible nodes for this group, we'll add them to the candidate solution and start with a new one