Weak, Regular, and Strong connectivity in directed graphs

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite
1












There are 3 types of connectivity when talking about a directed graph $G$.



1) weakly connected - replacing all of $G$'s directed edges with undirected edges produces a connected (undirected) graph.



2) connected - contains a directed path from $u$ to $v$ OR a directed path from $v$ to $u$ for every pair of vertices $u$, $v$



3) strongly connected - contains a directed path from $u$ to $v$ AND a directed path from $v$ to $u$ for every pair of vertices $u$, $v$




Efficient algorithm for determining...



weak connectivity - replace $G$'s directed edges with undirected edges and run DFS and see if it reaches every vertex



connectivity - ???



strong connectivity - run DFS on $G$ and see if it reaches every vertex, and then transpose $G$ (reverse each edge in $G$ to yield a new graph $G^T$) and run DFS on $G^T$ and see if it reaches every vertex (since the existence of a path from $u$ to $v$ in $G^T$ implies the existence of a path from $v$ to $u$ in $G$)



What is an efficient algorithm for determining if a directed graph G is connected in this intermediate sense between weak and strong?



EDIT:



I realized "efficient" is pretty vague. So more specifically, I mean that the algorithms I provided for weak connectivity and strong connectivity run in linear time ($O(V + E)$), and the naive algorithm for the intermediate connectivity of running all-pairs path finding and for each pair of vertices $(u, v)$ seeing if a path exists between them in either direction would run in something like $O(V^3)$ or $O(EVlnV)$. So I'm wondering if there is a linear time algorithm (or at least something better than the naive approach) to determining this intermediate connectivity, and what that might be.










share|cite|improve this question



















  • 1




    This intermediate "connectivity" for directed graphs does not seem to be a standard concept. I can find no reference to it outside the Wikipedia page for Connectivity (graph theory). Probably this is because, unlike either weak or strong connectivity, it fails to be transitive, thus not meeting the basic requirements for what "connected" ought to mean.
    – Kundor
    Jan 17 '16 at 1:02










  • Hmm, ok. Yeah, I got the concept from Wikipedia. To be honest, I don't particularly care about it if it's not a standard concept. Can you elaborate on what you mean by "transitive"?
    – tscizzle
    Jan 17 '16 at 1:14











  • With that definition, when a vertex $u$ is connected to a vertex $v$, and $v$ is connected to $w$, then $u$ is not necessarily connected to $w$.
    – Kundor
    Jan 17 '16 at 1:23










  • Ah, ok. I see now.
    – tscizzle
    Jan 17 '16 at 2:27






  • 1




    @Ben but isn't that not enough, because $u$ having a path to or from every $v0$ and $v1$ doesn't imply that $v0$ has a path to or from $v1$?
    – tscizzle
    Jan 17 '16 at 3:58














up vote
2
down vote

favorite
1












There are 3 types of connectivity when talking about a directed graph $G$.



1) weakly connected - replacing all of $G$'s directed edges with undirected edges produces a connected (undirected) graph.



2) connected - contains a directed path from $u$ to $v$ OR a directed path from $v$ to $u$ for every pair of vertices $u$, $v$



3) strongly connected - contains a directed path from $u$ to $v$ AND a directed path from $v$ to $u$ for every pair of vertices $u$, $v$




Efficient algorithm for determining...



weak connectivity - replace $G$'s directed edges with undirected edges and run DFS and see if it reaches every vertex



connectivity - ???



strong connectivity - run DFS on $G$ and see if it reaches every vertex, and then transpose $G$ (reverse each edge in $G$ to yield a new graph $G^T$) and run DFS on $G^T$ and see if it reaches every vertex (since the existence of a path from $u$ to $v$ in $G^T$ implies the existence of a path from $v$ to $u$ in $G$)



What is an efficient algorithm for determining if a directed graph G is connected in this intermediate sense between weak and strong?



EDIT:



I realized "efficient" is pretty vague. So more specifically, I mean that the algorithms I provided for weak connectivity and strong connectivity run in linear time ($O(V + E)$), and the naive algorithm for the intermediate connectivity of running all-pairs path finding and for each pair of vertices $(u, v)$ seeing if a path exists between them in either direction would run in something like $O(V^3)$ or $O(EVlnV)$. So I'm wondering if there is a linear time algorithm (or at least something better than the naive approach) to determining this intermediate connectivity, and what that might be.










share|cite|improve this question



















  • 1




    This intermediate "connectivity" for directed graphs does not seem to be a standard concept. I can find no reference to it outside the Wikipedia page for Connectivity (graph theory). Probably this is because, unlike either weak or strong connectivity, it fails to be transitive, thus not meeting the basic requirements for what "connected" ought to mean.
    – Kundor
    Jan 17 '16 at 1:02










  • Hmm, ok. Yeah, I got the concept from Wikipedia. To be honest, I don't particularly care about it if it's not a standard concept. Can you elaborate on what you mean by "transitive"?
    – tscizzle
    Jan 17 '16 at 1:14











  • With that definition, when a vertex $u$ is connected to a vertex $v$, and $v$ is connected to $w$, then $u$ is not necessarily connected to $w$.
    – Kundor
    Jan 17 '16 at 1:23










  • Ah, ok. I see now.
    – tscizzle
    Jan 17 '16 at 2:27






  • 1




    @Ben but isn't that not enough, because $u$ having a path to or from every $v0$ and $v1$ doesn't imply that $v0$ has a path to or from $v1$?
    – tscizzle
    Jan 17 '16 at 3:58












up vote
2
down vote

favorite
1









up vote
2
down vote

favorite
1






1





There are 3 types of connectivity when talking about a directed graph $G$.



1) weakly connected - replacing all of $G$'s directed edges with undirected edges produces a connected (undirected) graph.



2) connected - contains a directed path from $u$ to $v$ OR a directed path from $v$ to $u$ for every pair of vertices $u$, $v$



3) strongly connected - contains a directed path from $u$ to $v$ AND a directed path from $v$ to $u$ for every pair of vertices $u$, $v$




Efficient algorithm for determining...



weak connectivity - replace $G$'s directed edges with undirected edges and run DFS and see if it reaches every vertex



connectivity - ???



strong connectivity - run DFS on $G$ and see if it reaches every vertex, and then transpose $G$ (reverse each edge in $G$ to yield a new graph $G^T$) and run DFS on $G^T$ and see if it reaches every vertex (since the existence of a path from $u$ to $v$ in $G^T$ implies the existence of a path from $v$ to $u$ in $G$)



What is an efficient algorithm for determining if a directed graph G is connected in this intermediate sense between weak and strong?



EDIT:



I realized "efficient" is pretty vague. So more specifically, I mean that the algorithms I provided for weak connectivity and strong connectivity run in linear time ($O(V + E)$), and the naive algorithm for the intermediate connectivity of running all-pairs path finding and for each pair of vertices $(u, v)$ seeing if a path exists between them in either direction would run in something like $O(V^3)$ or $O(EVlnV)$. So I'm wondering if there is a linear time algorithm (or at least something better than the naive approach) to determining this intermediate connectivity, and what that might be.










share|cite|improve this question















There are 3 types of connectivity when talking about a directed graph $G$.



1) weakly connected - replacing all of $G$'s directed edges with undirected edges produces a connected (undirected) graph.



2) connected - contains a directed path from $u$ to $v$ OR a directed path from $v$ to $u$ for every pair of vertices $u$, $v$



3) strongly connected - contains a directed path from $u$ to $v$ AND a directed path from $v$ to $u$ for every pair of vertices $u$, $v$




Efficient algorithm for determining...



weak connectivity - replace $G$'s directed edges with undirected edges and run DFS and see if it reaches every vertex



connectivity - ???



strong connectivity - run DFS on $G$ and see if it reaches every vertex, and then transpose $G$ (reverse each edge in $G$ to yield a new graph $G^T$) and run DFS on $G^T$ and see if it reaches every vertex (since the existence of a path from $u$ to $v$ in $G^T$ implies the existence of a path from $v$ to $u$ in $G$)



What is an efficient algorithm for determining if a directed graph G is connected in this intermediate sense between weak and strong?



EDIT:



I realized "efficient" is pretty vague. So more specifically, I mean that the algorithms I provided for weak connectivity and strong connectivity run in linear time ($O(V + E)$), and the naive algorithm for the intermediate connectivity of running all-pairs path finding and for each pair of vertices $(u, v)$ seeing if a path exists between them in either direction would run in something like $O(V^3)$ or $O(EVlnV)$. So I'm wondering if there is a linear time algorithm (or at least something better than the naive approach) to determining this intermediate connectivity, and what that might be.







graph-theory algorithms connectedness






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Jan 16 '16 at 18:31

























asked Jan 16 '16 at 17:26









tscizzle

23619




23619







  • 1




    This intermediate "connectivity" for directed graphs does not seem to be a standard concept. I can find no reference to it outside the Wikipedia page for Connectivity (graph theory). Probably this is because, unlike either weak or strong connectivity, it fails to be transitive, thus not meeting the basic requirements for what "connected" ought to mean.
    – Kundor
    Jan 17 '16 at 1:02










  • Hmm, ok. Yeah, I got the concept from Wikipedia. To be honest, I don't particularly care about it if it's not a standard concept. Can you elaborate on what you mean by "transitive"?
    – tscizzle
    Jan 17 '16 at 1:14











  • With that definition, when a vertex $u$ is connected to a vertex $v$, and $v$ is connected to $w$, then $u$ is not necessarily connected to $w$.
    – Kundor
    Jan 17 '16 at 1:23










  • Ah, ok. I see now.
    – tscizzle
    Jan 17 '16 at 2:27






  • 1




    @Ben but isn't that not enough, because $u$ having a path to or from every $v0$ and $v1$ doesn't imply that $v0$ has a path to or from $v1$?
    – tscizzle
    Jan 17 '16 at 3:58












  • 1




    This intermediate "connectivity" for directed graphs does not seem to be a standard concept. I can find no reference to it outside the Wikipedia page for Connectivity (graph theory). Probably this is because, unlike either weak or strong connectivity, it fails to be transitive, thus not meeting the basic requirements for what "connected" ought to mean.
    – Kundor
    Jan 17 '16 at 1:02










  • Hmm, ok. Yeah, I got the concept from Wikipedia. To be honest, I don't particularly care about it if it's not a standard concept. Can you elaborate on what you mean by "transitive"?
    – tscizzle
    Jan 17 '16 at 1:14











  • With that definition, when a vertex $u$ is connected to a vertex $v$, and $v$ is connected to $w$, then $u$ is not necessarily connected to $w$.
    – Kundor
    Jan 17 '16 at 1:23










  • Ah, ok. I see now.
    – tscizzle
    Jan 17 '16 at 2:27






  • 1




    @Ben but isn't that not enough, because $u$ having a path to or from every $v0$ and $v1$ doesn't imply that $v0$ has a path to or from $v1$?
    – tscizzle
    Jan 17 '16 at 3:58







1




1




This intermediate "connectivity" for directed graphs does not seem to be a standard concept. I can find no reference to it outside the Wikipedia page for Connectivity (graph theory). Probably this is because, unlike either weak or strong connectivity, it fails to be transitive, thus not meeting the basic requirements for what "connected" ought to mean.
– Kundor
Jan 17 '16 at 1:02




This intermediate "connectivity" for directed graphs does not seem to be a standard concept. I can find no reference to it outside the Wikipedia page for Connectivity (graph theory). Probably this is because, unlike either weak or strong connectivity, it fails to be transitive, thus not meeting the basic requirements for what "connected" ought to mean.
– Kundor
Jan 17 '16 at 1:02












Hmm, ok. Yeah, I got the concept from Wikipedia. To be honest, I don't particularly care about it if it's not a standard concept. Can you elaborate on what you mean by "transitive"?
– tscizzle
Jan 17 '16 at 1:14





Hmm, ok. Yeah, I got the concept from Wikipedia. To be honest, I don't particularly care about it if it's not a standard concept. Can you elaborate on what you mean by "transitive"?
– tscizzle
Jan 17 '16 at 1:14













With that definition, when a vertex $u$ is connected to a vertex $v$, and $v$ is connected to $w$, then $u$ is not necessarily connected to $w$.
– Kundor
Jan 17 '16 at 1:23




With that definition, when a vertex $u$ is connected to a vertex $v$, and $v$ is connected to $w$, then $u$ is not necessarily connected to $w$.
– Kundor
Jan 17 '16 at 1:23












Ah, ok. I see now.
– tscizzle
Jan 17 '16 at 2:27




Ah, ok. I see now.
– tscizzle
Jan 17 '16 at 2:27




1




1




@Ben but isn't that not enough, because $u$ having a path to or from every $v0$ and $v1$ doesn't imply that $v0$ has a path to or from $v1$?
– tscizzle
Jan 17 '16 at 3:58




@Ben but isn't that not enough, because $u$ having a path to or from every $v0$ and $v1$ doesn't imply that $v0$ has a path to or from $v1$?
– tscizzle
Jan 17 '16 at 3:58










3 Answers
3






active

oldest

votes

















up vote
0
down vote













Two quick comments:



a) for strong connectedness you could save a little bit of time running DFS from one "hub" vertex $h$ in $G$ and then DFS for the same $h$ in $G^T$. Obviously if you have path $urightarrow h$ and $hrightarrow v$ for any vertices $u$, $v$ then you have path from $u$ to $v$.



b) for your semi-connectivity (from item 2) there is an expensive way to do that by building the entire connectedness matrix $M = C(G)$ for $G$ -- and then we check that all elements in $M+M^T$ are positive. On the bright(er) side, DFS-like algorithm for $C(G)$-computation will allow you to build entire strong connectedness components which makes computing $C(G)$ a little easier.






share|cite|improve this answer



























    up vote
    0
    down vote













    This type of intermediate connectivity is often called semi-connectivity.
    If you used this notion you would find out that your question already has a very comprehensive answer on stackoverflow: https://stackoverflow.com/questions/30642383/determine-if-a-graph-is-semi-connected-or-not



    I will sketch it here simplified though.



    Idea is to reduce problem by reducing digraph G to it's graph of SCC's, say G', that is always acyclic and then try to find a path that covers all nodes in G'. If there is no such path then it's not possible to get from some SCC to some other (G' is acyclic) and that means that vertices in them have no connections. Otherwise G' is semi-connected and so is G.



    Input: digraph G = (V,E)



    Output: true or false if it's semi-connected



    init graph G'=(V',E') from SCC's of G where V' is set of SCC of G and E' are edges between them or $E'= v_1',v_2'in V'$ and $exists (v_1,v_2)in E$, $v_1 in v_1',v_2 in v_2'$
    // G' guaranteed to be acyclic and this can be done in O(|V| + |E|), for example, using Kosaraju's algorithm



    find topological ordering $T=(v_0,...,v_)$ of G' // correct as G' is acyclic and also can be done in O(|V'| + |E'|) using modification of DFS.



    if some possible pair $(v_i,v_i+1)$ in T is not in E' ouput false, otherwise true // if not then $(v_i+1,v_i)$ also is not in E' and there is no connection between vertices in $v_i$ and $v_i+1$, takes O(|V'|)






    share|cite|improve this answer





























      up vote
      0
      down vote













      To check for "regular connected" (semi-connected) directed graph $G$:



      1) Form the condensation of $G$ (linear time), giving a directed acyclic graph $H$



      2) If $H$ is a (directed) path, $G$ is "regular connected". (If $H$ has multiple branches, sources or sinks, $G$ is not "regular connected").






      share|cite|improve this answer






















        Your Answer




        StackExchange.ifUsing("editor", function ()
        return StackExchange.using("mathjaxEditing", function ()
        StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
        StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
        );
        );
        , "mathjax-editing");

        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "69"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        convertImagesToLinks: true,
        noModals: false,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        noCode: true, onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );













         

        draft saved


        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1614641%2fweak-regular-and-strong-connectivity-in-directed-graphs%23new-answer', 'question_page');

        );

        Post as a guest






























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes








        up vote
        0
        down vote













        Two quick comments:



        a) for strong connectedness you could save a little bit of time running DFS from one "hub" vertex $h$ in $G$ and then DFS for the same $h$ in $G^T$. Obviously if you have path $urightarrow h$ and $hrightarrow v$ for any vertices $u$, $v$ then you have path from $u$ to $v$.



        b) for your semi-connectivity (from item 2) there is an expensive way to do that by building the entire connectedness matrix $M = C(G)$ for $G$ -- and then we check that all elements in $M+M^T$ are positive. On the bright(er) side, DFS-like algorithm for $C(G)$-computation will allow you to build entire strong connectedness components which makes computing $C(G)$ a little easier.






        share|cite|improve this answer
























          up vote
          0
          down vote













          Two quick comments:



          a) for strong connectedness you could save a little bit of time running DFS from one "hub" vertex $h$ in $G$ and then DFS for the same $h$ in $G^T$. Obviously if you have path $urightarrow h$ and $hrightarrow v$ for any vertices $u$, $v$ then you have path from $u$ to $v$.



          b) for your semi-connectivity (from item 2) there is an expensive way to do that by building the entire connectedness matrix $M = C(G)$ for $G$ -- and then we check that all elements in $M+M^T$ are positive. On the bright(er) side, DFS-like algorithm for $C(G)$-computation will allow you to build entire strong connectedness components which makes computing $C(G)$ a little easier.






          share|cite|improve this answer






















            up vote
            0
            down vote










            up vote
            0
            down vote









            Two quick comments:



            a) for strong connectedness you could save a little bit of time running DFS from one "hub" vertex $h$ in $G$ and then DFS for the same $h$ in $G^T$. Obviously if you have path $urightarrow h$ and $hrightarrow v$ for any vertices $u$, $v$ then you have path from $u$ to $v$.



            b) for your semi-connectivity (from item 2) there is an expensive way to do that by building the entire connectedness matrix $M = C(G)$ for $G$ -- and then we check that all elements in $M+M^T$ are positive. On the bright(er) side, DFS-like algorithm for $C(G)$-computation will allow you to build entire strong connectedness components which makes computing $C(G)$ a little easier.






            share|cite|improve this answer












            Two quick comments:



            a) for strong connectedness you could save a little bit of time running DFS from one "hub" vertex $h$ in $G$ and then DFS for the same $h$ in $G^T$. Obviously if you have path $urightarrow h$ and $hrightarrow v$ for any vertices $u$, $v$ then you have path from $u$ to $v$.



            b) for your semi-connectivity (from item 2) there is an expensive way to do that by building the entire connectedness matrix $M = C(G)$ for $G$ -- and then we check that all elements in $M+M^T$ are positive. On the bright(er) side, DFS-like algorithm for $C(G)$-computation will allow you to build entire strong connectedness components which makes computing $C(G)$ a little easier.







            share|cite|improve this answer












            share|cite|improve this answer



            share|cite|improve this answer










            answered Jan 25 '17 at 17:06









            JimT

            1947




            1947




















                up vote
                0
                down vote













                This type of intermediate connectivity is often called semi-connectivity.
                If you used this notion you would find out that your question already has a very comprehensive answer on stackoverflow: https://stackoverflow.com/questions/30642383/determine-if-a-graph-is-semi-connected-or-not



                I will sketch it here simplified though.



                Idea is to reduce problem by reducing digraph G to it's graph of SCC's, say G', that is always acyclic and then try to find a path that covers all nodes in G'. If there is no such path then it's not possible to get from some SCC to some other (G' is acyclic) and that means that vertices in them have no connections. Otherwise G' is semi-connected and so is G.



                Input: digraph G = (V,E)



                Output: true or false if it's semi-connected



                init graph G'=(V',E') from SCC's of G where V' is set of SCC of G and E' are edges between them or $E'= v_1',v_2'in V'$ and $exists (v_1,v_2)in E$, $v_1 in v_1',v_2 in v_2'$
                // G' guaranteed to be acyclic and this can be done in O(|V| + |E|), for example, using Kosaraju's algorithm



                find topological ordering $T=(v_0,...,v_)$ of G' // correct as G' is acyclic and also can be done in O(|V'| + |E'|) using modification of DFS.



                if some possible pair $(v_i,v_i+1)$ in T is not in E' ouput false, otherwise true // if not then $(v_i+1,v_i)$ also is not in E' and there is no connection between vertices in $v_i$ and $v_i+1$, takes O(|V'|)






                share|cite|improve this answer


























                  up vote
                  0
                  down vote













                  This type of intermediate connectivity is often called semi-connectivity.
                  If you used this notion you would find out that your question already has a very comprehensive answer on stackoverflow: https://stackoverflow.com/questions/30642383/determine-if-a-graph-is-semi-connected-or-not



                  I will sketch it here simplified though.



                  Idea is to reduce problem by reducing digraph G to it's graph of SCC's, say G', that is always acyclic and then try to find a path that covers all nodes in G'. If there is no such path then it's not possible to get from some SCC to some other (G' is acyclic) and that means that vertices in them have no connections. Otherwise G' is semi-connected and so is G.



                  Input: digraph G = (V,E)



                  Output: true or false if it's semi-connected



                  init graph G'=(V',E') from SCC's of G where V' is set of SCC of G and E' are edges between them or $E'= v_1',v_2'in V'$ and $exists (v_1,v_2)in E$, $v_1 in v_1',v_2 in v_2'$
                  // G' guaranteed to be acyclic and this can be done in O(|V| + |E|), for example, using Kosaraju's algorithm



                  find topological ordering $T=(v_0,...,v_)$ of G' // correct as G' is acyclic and also can be done in O(|V'| + |E'|) using modification of DFS.



                  if some possible pair $(v_i,v_i+1)$ in T is not in E' ouput false, otherwise true // if not then $(v_i+1,v_i)$ also is not in E' and there is no connection between vertices in $v_i$ and $v_i+1$, takes O(|V'|)






                  share|cite|improve this answer
























                    up vote
                    0
                    down vote










                    up vote
                    0
                    down vote









                    This type of intermediate connectivity is often called semi-connectivity.
                    If you used this notion you would find out that your question already has a very comprehensive answer on stackoverflow: https://stackoverflow.com/questions/30642383/determine-if-a-graph-is-semi-connected-or-not



                    I will sketch it here simplified though.



                    Idea is to reduce problem by reducing digraph G to it's graph of SCC's, say G', that is always acyclic and then try to find a path that covers all nodes in G'. If there is no such path then it's not possible to get from some SCC to some other (G' is acyclic) and that means that vertices in them have no connections. Otherwise G' is semi-connected and so is G.



                    Input: digraph G = (V,E)



                    Output: true or false if it's semi-connected



                    init graph G'=(V',E') from SCC's of G where V' is set of SCC of G and E' are edges between them or $E'= v_1',v_2'in V'$ and $exists (v_1,v_2)in E$, $v_1 in v_1',v_2 in v_2'$
                    // G' guaranteed to be acyclic and this can be done in O(|V| + |E|), for example, using Kosaraju's algorithm



                    find topological ordering $T=(v_0,...,v_)$ of G' // correct as G' is acyclic and also can be done in O(|V'| + |E'|) using modification of DFS.



                    if some possible pair $(v_i,v_i+1)$ in T is not in E' ouput false, otherwise true // if not then $(v_i+1,v_i)$ also is not in E' and there is no connection between vertices in $v_i$ and $v_i+1$, takes O(|V'|)






                    share|cite|improve this answer














                    This type of intermediate connectivity is often called semi-connectivity.
                    If you used this notion you would find out that your question already has a very comprehensive answer on stackoverflow: https://stackoverflow.com/questions/30642383/determine-if-a-graph-is-semi-connected-or-not



                    I will sketch it here simplified though.



                    Idea is to reduce problem by reducing digraph G to it's graph of SCC's, say G', that is always acyclic and then try to find a path that covers all nodes in G'. If there is no such path then it's not possible to get from some SCC to some other (G' is acyclic) and that means that vertices in them have no connections. Otherwise G' is semi-connected and so is G.



                    Input: digraph G = (V,E)



                    Output: true or false if it's semi-connected



                    init graph G'=(V',E') from SCC's of G where V' is set of SCC of G and E' are edges between them or $E'= v_1',v_2'in V'$ and $exists (v_1,v_2)in E$, $v_1 in v_1',v_2 in v_2'$
                    // G' guaranteed to be acyclic and this can be done in O(|V| + |E|), for example, using Kosaraju's algorithm



                    find topological ordering $T=(v_0,...,v_)$ of G' // correct as G' is acyclic and also can be done in O(|V'| + |E'|) using modification of DFS.



                    if some possible pair $(v_i,v_i+1)$ in T is not in E' ouput false, otherwise true // if not then $(v_i+1,v_i)$ also is not in E' and there is no connection between vertices in $v_i$ and $v_i+1$, takes O(|V'|)







                    share|cite|improve this answer














                    share|cite|improve this answer



                    share|cite|improve this answer








                    edited May 23 '17 at 12:39









                    Community♦

                    1




                    1










                    answered Apr 21 '17 at 18:57









                    littlewhywhat

                    285




                    285




















                        up vote
                        0
                        down vote













                        To check for "regular connected" (semi-connected) directed graph $G$:



                        1) Form the condensation of $G$ (linear time), giving a directed acyclic graph $H$



                        2) If $H$ is a (directed) path, $G$ is "regular connected". (If $H$ has multiple branches, sources or sinks, $G$ is not "regular connected").






                        share|cite|improve this answer


























                          up vote
                          0
                          down vote













                          To check for "regular connected" (semi-connected) directed graph $G$:



                          1) Form the condensation of $G$ (linear time), giving a directed acyclic graph $H$



                          2) If $H$ is a (directed) path, $G$ is "regular connected". (If $H$ has multiple branches, sources or sinks, $G$ is not "regular connected").






                          share|cite|improve this answer
























                            up vote
                            0
                            down vote










                            up vote
                            0
                            down vote









                            To check for "regular connected" (semi-connected) directed graph $G$:



                            1) Form the condensation of $G$ (linear time), giving a directed acyclic graph $H$



                            2) If $H$ is a (directed) path, $G$ is "regular connected". (If $H$ has multiple branches, sources or sinks, $G$ is not "regular connected").






                            share|cite|improve this answer














                            To check for "regular connected" (semi-connected) directed graph $G$:



                            1) Form the condensation of $G$ (linear time), giving a directed acyclic graph $H$



                            2) If $H$ is a (directed) path, $G$ is "regular connected". (If $H$ has multiple branches, sources or sinks, $G$ is not "regular connected").







                            share|cite|improve this answer














                            share|cite|improve this answer



                            share|cite|improve this answer








                            edited Apr 20 at 19:36

























                            answered Apr 20 at 18:41









                            Joffan

                            31.9k43169




                            31.9k43169



























                                 

                                draft saved


                                draft discarded















































                                 


                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1614641%2fweak-regular-and-strong-connectivity-in-directed-graphs%23new-answer', 'question_page');

                                );

                                Post as a guest













































































                                這個網誌中的熱門文章

                                Is there any way to eliminate the singular point to solve this integral by hand or by approximations?

                                Why am i infinitely getting the same tweet with the Twitter Search API?

                                Carbon dioxide