|
SOLUTIONS
|
BUILT-IN MATHEMATICA SYMBOL
Graph
Graph[{e1, e2, ...}]
yields a graph with edges
.
Graph[{v1, v2, ...}, {e1, e2, ...}]
yields the graph with vertices
and edges
.
Graph[{..., wi[vi, ...], ...}, {..., wj[ej, ...], ...}]
yields a graph with vertex and edge properties defined by the symbolic wrappers
.
Details and OptionsDetails and Options
- Graph[...] displays in a notebook as a plot of a graph.
- Graph[...] is always converted to an optimized standard form with structure Graph[vertices, edges, ...].
- Graph is treated as a raw object by functions like AtomQ, and for purposes of pattern matching.
- An undirected edge between u and v can be given as
or UndirectedEdge[u, v]. The character
can be entered as EscueEsc. - A directed edge from u to v can be given as
,
, or DirectedEdge[u, v]. The character
can be entered as EscdeEsc. - An undirected graph is specified using a collection of undirected edges.
- A directed graph is specified using a collection of directed edges.
- The following special wrappers can be used for vertices and edges:
-
Annotation[a,label] provide an annotation Button[a,action] define an action to execute when the element is clicked EventHandler[a,...] define a general event handler for the element Hyperlink[a,uri] make the element act as a hyperlink Labeled[a,...] display the element with labeling PopupWindow[a,cont] attach a popup window to the element StatusArea[a,label] display in the status area when the element is moused over Style[a,opts] show the element using the specified styles Tooltip[a,label] attach an arbitrary tooltip to the element - The possible label placements are given in VertexLabels and EdgeLabels, respectively.
- Property can be used to associate properties with vertices and edges:
-
Property[v,name->value] associate the property
with the vertex vProperty[e,name->value] associate the property
with the edge e - The following standard properties are supported for vertices:
-
VertexLabels labels and label placement for vertex VertexCoordinates center coordinates for vertex VertexShape graphic shape for vertex VertexSize size of vertex VertexStyle style for vertex VertexShapeFunction shape-rendering function for vertex VertexWeight weight for vertex - The following standard properties are supported for edges:
-
EdgeLabels labels for label placement for edge EdgeStyle style for edge EdgeShapeFunction shape-rendering function for edge EdgeWeight weight for edge - Graph has the same options as Graphics, with the following additions and changes:
-
DirectedEdges Automatic whether to interpret Rule as DirectedEdge EdgeLabels Automatic labels and placements for edges EdgeLabelStyle Automatic style to use for edge labels EdgeShapeFunction Automatic generate graphic shapes for edges EdgeStyle Automatic styles for edges EdgeWeight Automatic weights for edges GraphLayout Automatic how to lay out vertices and edges GraphStyle Automatic overall style for graph elements GraphHighlight {} graph elements to highlight GraphHighlightStyle Automatic style for highlight PerformanceGoal $PerformanceGoal aspects of performance to try to optimize Properties {} properties for graph, edges, and vertices VertexCoordinates Automatic coordinates for vertices VertexLabels Automatic labels and placements for vertices VertexLabelStyle Automatic style to use for vertex labels VertexShape Automatic graphic shape for vertices VertexShapeFunction Automatic generate graphic shapes for vertices VertexSize Medium size of vertices VertexStyle Automatic styles for vertices VertexWeight Automatic weights for vertices - Properties->{a->{name1->val1, ...}, ...} associates the property
etc. with a that can be a vertex, edge, or the graph itself. The following strings for a have special meanings: -
"DefaultEdgeProperties" default edge properties "DefaultVertexProperties" default vertex properties "GraphProperties" properties for the graph itself - With the setting VertexCoordinates->Automatic, the placement of vertices and routing of edges is computed automatically, based on the setting for GraphLayout.
- Style and other specifications for edges are effectively applied in the order GraphStyle, EdgeStyle, GraphHighlightStyle, Style and other wrappers, and EdgeShapeFunction, with later specifications overriding earlier ones.
- Style and other specifications for vertices are effectively applied in the order GraphStyle, VertexStyle, GraphHighlightStyle, Style and other wrappers, and VertexShapeFunction, with later specifications overriding earlier ones.
- Label style and other specifications for edge labels are effectively applied in the order GraphStyle, EdgeLabelStyle, GraphHighlightStyle, Labeled, and EdgeLabels, with later specifications overriding earlier ones.
- Label style and other specifications for vertex labels are effectively applied in the order GraphStyle, VertexLabelStyle, GraphHighlightStyle, Labeled, and VertexLabels, with later specifications overriding earlier ones.
New in 8
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »







