algorithms – How can I generate a random sample of unique vertex pairings from a undirected graph, with uniform probability?

I’m working on a research project where I have to pair up entities together and analyze outcomes. Normally, without constraints on how the entities can be paired, I could easily select one random entity pair, remove it from the pool, then randomly select the next entity pair.

That would be like creating a random sample of vertex pairs from a complete graph.

However, this time around the undirected graph is now

  • incomplete
  • with a possibility that the graph might be disconnected.

I thought about using the above method but realized that my sample would not have a uniform probability of being chosen, as probabilities of pairings are no longer independent of each other due to uneven vertex degrees.

I’m banging my head at the wall for this. It’s best for research that I generate a sample with uniform probability. Given that my graph has around n = 5000 vertices, is there an algorithm that i could use such that the resulting sample fulfils these conditions?

  1. There are no duplicates in the sample (all vertices in the graph only is paired once).
  2. The remaining vertices that are not in the sample do not have an edge with each other. (They are unpaired and cannot be paired)
  3. The sample generated that meets the above two criteria should have a uniform probability of being chosen as compared to any other sample that fulfils the above two points.

There appear to be some work done for bipartite graphs as seen on this stackoverflow discussion here. The algorithms described obtains a near-uniform sample but doesn’t seem to be able to apply to this case.

Social networks – How to minimize the spread in undirected weighted charts

I have a job related to networks where each edge has a weight ($ w in (0.1) $) and some random nodes are & # 39; infected & # 39 ;. I don't know which nodes (or how many) are. Diffusion scatter corresponds to the linear threshold model (with a random threshold) $ theta in (0,3,0,5) $. I can only delete $ 10 % $ edges from the original diagram before setting the parameters (I don't know the initially infected nodes or the threshold from the start).

I tried several methods like:

  1. First remove the highest weighted edges – This will perform well if only a small number of initially infected nodes are specified.
  2. remove local bridges – I sorted the edges by neighborhood overlap and then removed by weight. – This works well at low thresholds.
  3. Multiple variations of vertex coverage, edge coverage, centrality, intermediate equality, etc. – Everyone has left behind the "naive" approach to weight removal (shown in (1)).
  4. Clustering heuristics – tries to construct clusters and remove cutting edges (by weight, etc.).

It is difficult for me to "accept" this approach (1), which seems to be very naive – surpasses all others.

In addition, several papers went through and implemented some of the ideas suggested – none exceeded this naive approach.

I would appreciate it if someone with similar experience has something to recommend.

Algorithms – Detect a cycle in an undirected diagram and print the vertices if there is a cycle, otherwise no cycle

Problem: Find an O (E + V) time algorithm that returns the vertices of a cycle of G, if any. If G has no cycles, the algorithm does not output a cycle. So if there is a cycle 1, … 3, 1, 1, …, 3, 1 is printed.

So I thought about doing an FSO, and if the neighbor v of the vertex currently being examined was visited before, there is a cycle. However, I'm not sure how to track the vertices to print. I think I should see the BFS tree, but I'm not sure.

Algorithms – Find two non-overlapping paths on an undirected diagram

I've had trouble tackling a problem for over two weeks. I'm supposed to create an undirected diagram that shows a street map, and I'm going to divide the map into two sets of non-overlapping streets that contain roughly the same number of streets.

Is this a common CS problem? What kind of algorithm should I use to solve it?

Suppose we have an unweighted, undirected graph with vertices A, B, C, D, E.

A --- B 
|   / | 
|  /  |  C
| /   | / 
D --- E 

What does an adjacency matrix like this mean:

  A  B  C  D  E
A -  1  0  1  0
B 1  -  1  1  1
C 0  1  -  0  1
D 1  1  0  -  1
E 0  1  1  1  -

Assuming all edges are non-directional, we have the following edges:

(a,b) (a,d) (b,d) (b,e) (b,c) (e,d) (e,c)

What I want is that I can use AI to take this graph and create two groups of edges about the same size. (In this particular case, since we have 7 edges, we would get a group of 3 edges and another of 4 edges.

Group 1: (a,b) (a,d) (b,d) (e,d)
A --- B 
|   / 
|  /  
| /     
D --- E 

Group 2: (b,e) (b,c) (e,c)
|  C
| / 

Note that all edges in each group are connected by at least one node. This is a requirement.

Another valid solution could be, for example:

Group 1: (d,a) (a,b) (b,c) (c,e)
A --- B 
|       C
|       / 
D     E 
Group 2: (d,b) (b,e) (e,d)
    / |
   /  |
  /   | 
D --- E 

As you can see there are many valid solutions, but I want an algorithm to find one and I will keep the first one found. How would I do it?

I am sure there is a formal way to name this problem and I will greatly appreciate it if you tell me how to do it.

graphs – algorithm for undirected parsing of projective dependencies

I'm looking for an algorithm that gets an optimal projective undirected dependency analysis.

That said, given the phrase "Mary loves John" and an edge weight function $ f $ (that is, a function of word pairs in the sentence to real numbers), like

$ f $(Mary does it) = 1

$ f $(Maria, love) = 5

$ f $(Mary, John) = 2

$ f $(does, love) = 2

$ f $(does, John) = 3

$ f $(Love, John) = 5

I want an algorithm that gives the edges of the maximum projective spanning tree as follows:
{(Mary, love), (does, loves), (love, John)} with a total weight of 12. That means there should be:

It is crucial that the algorithm should not give {(Mary, love), (does, John), (love, John)}, although it has a higher weight of 13, because in this case the dependencies are not projective (the arcs ) (Maria, love), (does, John) cross each other). That said, it should Not Give this:

I also ask: What algorithms are there to find a minimum / maximum spanning tree in an ordered graph so that the resulting structure is projective? A little more formal: with a fully ordered set of nodes $ (S, <) $and an edge weight function $ W: S × S → ℝ $Is there a good algorithm to find the spanning tree with optimal weighting over this set of nodes so that the resulting structure has the property that each subtree is contiguous in order (for each subtree) $ T $, for all $ t, s $ in the $ T $ there is no $ r $ not in $ T $ so that $ t <r <s $)?

  • Without the projectivity requirement, any classic MST algorithm (such as that of Prim or Kruskal) can be used.
  • With the projectivity requirement, but for directional Diagrams / dependencies The Eisner algorithm (a faster version of Arc-Factored Projective Parsing) is standard to get the optimal directional projective dependency analysis.

I'm looking for a (probably CYK-like) algorithm like Eisner's, but it works for undirected dependency analysis. That is, an algorithm to find the maximum projective spanning tree for nondirectional ordered graphs. Or maybe proof that the Eisner algorithm works with some modifications on undirected graphs is guaranteed to provide the optimal projective spanning tree.

Presence of an undirected connected graph in which the nodes must end with the assigned value

We have a diagram with N nodes and N-1 undirected edges, in which it is possible to reach a node from any other node. Each node is randomly assigned a value from (1, …, 10). We want each node's value to end at 10. The way we update is as follows: when we visit a node, we increase the value of that node with wraparound by 1 (e.g. 7 -> 8 and 10 -> 1)). We can revisit nodes and edges at will. We do not initially introduce the counter in our node from which we start. Return the number of possible nodes from which we can start, so that each node ends with a value of 10.

I tried just doing a simple backtracking search for the states, but the complexity is far too high and I don't know when to say "not possible" as we can switch from 10 to 1.

Shortest cycles in undirected graphs

Find the shortest cycle that contains a particular vertex on an undirected (and unweighted) chart $ s $It is usually said that a BFS is running $ s $ and the first time to find another visit, this is the smallest cycle length you want.

This does not seem to be true, quoted from page 3:

Keep this in mind when you run BFS from $ s $ and stop once you visit a again
You may not get the vertex (using a previously unused edge)
shortest path contains $ s $,

Examples where this technique seems to be suggested: An efficient algorithm to find a shortest cycle including a specific vertex

Another technique, in which the shortest cycle in the entire diagram is determined by executing BFS from each vertex, seems to recognize only the shortest length +1 in a special case, as mentioned in this document: https: // link. /10.1007/978-3-540-78773-0_63 in the "unweighted case". on the other handHere ( it is mentioned (first and second paragraph) that executing BFS results in every case from each vertex the shortest length (circumference). This is also mentioned in an archive ( , ,

Which of all algorithms / methods applies to:

  1. Can you find the cycle with the shortest length in an undirected diagram?
  2. Find the shortest length cycle that passes through a known vertex $ s $ in an undirected graph?
  3. Where is the trap in each of my comparisons and contrasts above? (I can't believe some of the above are even wrong …)

Note: A randomized sub-cubic algorithm appears to exist in Raphael Yuster's publication "A shortest cycle for each vertex of a graph": .pdf