Struct Graph

Source
pub struct Graph<A> {
    pub strict: bool,
    pub is_digraph: bool,
    pub name: Option<String>,
    pub attr: Vec<AttrStmt<A>>,
    pub nodes: NodeSet<A>,
    pub edges: EdgeSet<A>,
    pub ideqs: Vec<IDEq>,
}
Expand description

A Graph is a structure that can be created from a regular Graph, but that is more friendly to work with. For instance, in a Graph, attributes are most often given as a list of list of Attr, while in a Graph, the lists are flatten.

Fields§

§strict: bool

Specifies if the Graph is strict or not. A “strict” graph must not contain the same edge multiple times. Notice that, for undirected edge, an edge from A to B and an edge from B to A are equals.

§is_digraph: bool

Specifies if the Graph is directed.

§name: Option<String>

The name of the Graph, if any.

§attr: Vec<AttrStmt<A>>

The global attributes of the graph.

§nodes: NodeSet<A>

The nodes of the graph.

§edges: EdgeSet<A>

The edges of the graph.

§ideqs: Vec<IDEq>

The ID equalities declared in the graph.

Implementations§

Source§

impl<A> Graph<A>

Source

pub fn filter_map<F, B>(self, f: F) -> Graph<B>
where F: Fn(A) -> Option<B>,

Filter and map attributes. The main intended usage of this function is to convert attributes as &'a str into an enum, e.g. to convert ["label"="whatever", "color"="foo"] into [Attr::Label(whatever), Attr::Color(foo)].

To take into account non-standard attributes, the Attr enum has to be provided by the user.

Trait Implementations§

Source§

impl<A: Clone> Clone for Graph<A>

Source§

fn clone(&self) -> Graph<A>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<A: Debug> Debug for Graph<A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<A, G> From<G> for Graph<A>
where G: Into<Graph<A>>, A: Clone,

Source§

fn from(graph: G) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<A> Freeze for Graph<A>

§

impl<A> RefUnwindSafe for Graph<A>
where A: RefUnwindSafe,

§

impl<A> Send for Graph<A>
where A: Send,

§

impl<A> Sync for Graph<A>
where A: Sync,

§

impl<A> Unpin for Graph<A>
where A: Unpin,

§

impl<A> UnwindSafe for Graph<A>
where A: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.