0
$\begingroup$

Let us consider a graph1:

g1 = {1 <-> 2, 2 <-> 3, 3 <-> 4, 4 <-> 5, 5 <-> 6, 6 <-> 7, 7 <-> 19,19 <-> 20, 19 <-> 22, 20 <-> 21, 20 <-> 23, 7 <-> 8, 8 <-> 24, 24 <-> 25, 24 <-> 26, 8 <-> 9, 9 <-> 10, 9 <-> 27, 27 <-> 28, 27 <-> 29, 10 <-> 11, 11 <-> 12, 12 <-> 13, 13 <-> 14, 14 <-> 15,15 <-> 16, 16 <-> 17, 17 <-> 18, 12 <-> 30, 30 <-> 31, 31 <-> 32, 32 <-> 33, 30 <-> 34, 31 <-> 35, 32 <-> 36, 34 <-> 37, 34 <-> 38, 2 <-> 39, 3 <-> 40, 4 <-> 41, 5 <-> 42, 6 <-> 43, 10 <-> 44, 11 <-> 45, 13 <-> 46, 14 <-> 47, 15 <-> 48, 16 <-> 49, 17 <-> 50,18 <-> 51, 18 <-> 52, 1 <-> 53, 1 <-> 54};

enter image description here

How to split graph1 in a specific node? Let the division node be a node 7. After division in node 7 we should get two graphs:

enter image description here

enter image description here

I made this division by hand. The problem arises when I have a very large graph. The FindGraphPartition [] function is not suitable.

$\endgroup$
8
  • 2
    $\begingroup$ Have you noticed that you can "split" the graph on vertex 7 multiple differing ways? $\endgroup$
    – kirma
    Commented Mar 28, 2018 at 6:54
  • $\begingroup$ Yes I know. This is one of the versions. Now, we are cutting the graph between node 7 and 8. $\endgroup$
    – ralph
    Commented Mar 28, 2018 at 7:28
  • $\begingroup$ This abomination can be used as a starting point: With[{v = 7}, (Subgraph[g1, #, VertexLabels -> "Name"] & /@ WeaklyConnectedComponents@EdgeDelete[g1, Map[v <-> # &, #]]) & /@ Subsets[#, If[Length@# > 1, {1, Length@# - 1}, {}]] & @ AdjacencyList[g1, v]] - it lists all combinations of subgraphs for which v is connected to at least one, and at least one edge to v has been removed. $\endgroup$
    – kirma
    Commented Mar 28, 2018 at 8:12
  • 1
    $\begingroup$ Just like with your previous questions that featured this graph, the problem is not very clearly stated. Can you explain the problem in a mathematically unambiguous way? As far as I can see you simply selected an arbitrary edge incident to vertex 7 (look up IncidenceList) and removed it (look up EdgeDelete). $\endgroup$
    – Szabolcs
    Commented Mar 28, 2018 at 10:52
  • $\begingroup$ If these two functions don't solve the problem, can you elaborate? $\endgroup$
    – Szabolcs
    Commented Mar 28, 2018 at 11:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.