H = flipedge(G)
returns a directed graph that has the same edges as G, but with
reversed directions. H contains the same node and edge properties
as G.
Input graph, specified as a digraph object. Use digraph to create a directed graph object.
Example: G = digraph([1 2],[2 3])
Node pairs, specified as separate arguments of node indices or node names.
Similarly located elements in s and t
specify the source and target nodes for edges in the graph.
This table shows the different ways to refer to one or more nodes either by their numeric node indices or by their node names.
Form
Single Node
Multiple Nodes
Node index
Scalar
Example:1
Vector
Example:[1 2 3]
Node name
Character vector
Example:'A'
Cell array of character vectors
Example:{'A' 'B' 'C'}
String scalar
Example:"A"
String array
Example:["A" "B" "C"]
Example: H = flipedge(G,[1 4],[2 3]) reverses the
direction of the edges (1,2) and (4,3).
Example: H = flipedge(G,{'a' 'd'},{'b' 'c'}) reverses
the direction of the edges (a,b) and (d,c).
Edge indices, specified as a scalar or vector of positive integers. Each
edge index corresponds to a row in the G.Edges table of
the graph G.Edges(idx,:).
Example: H = flipedge(G,3) flips the direction of edge
G.Edges(3,:).
Output graph, returned as a digraph object. Compared to
G, H has the same nodes but some
or all of the edges are in reversed direction. H also has
the same node and edge properties as G.
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.