# Class: Edge

## Edge

#### new Edge(nodes, props)

Constructs a new Edge

##### Parameters:

Name | Type | Description
--- | --- | ---
`nodes` | Array | Array of two Nodes representing a graph edge. Since an Edge is undirected, the order of the Nodes in the Array does not matter.
`props` | Object | Object containing optional properties of the Edge ###### Properties
Name | Type | Description
--- | --- | ---
`color` | Number | String | Hexadecimal or CSS-style string representation of a color; defaults to 'white'

Source:
  - graphosaurus_src/graphosaurus.js, line 71488

### Methods

#### addTo(graph) → {Edge}

Add the Edge to a Graph. Upon adding, if the Edge contains Node string ID's, they will be looked up in the Graph and replaced with Node instances.

##### Parameters:

Name | Type | Description
--- | --- | ---
`graph` | Graph | Graph the Edge will be added to

Source:
  - graphosaurus_src/graphosaurus.js, line 71572

##### Returns:

The Edge the method was called on

Type
  Edge

#### getColor() → {String}

Gets the color of the Edge

Source:
  - graphosaurus_src/graphosaurus.js, line 71562

##### Returns:

String hexadecimal representation of the Edge's color

Type
  String

##### Example

    myEdge.setColor("green");
    myEdge.getColor();  // returns "008000"

#### getNodes() → {Array}

Get the nodes of the Edge

Source:
  - graphosaurus_src/graphosaurus.js, line 71525

##### Returns:

Array of two Nodes that represent the ends of the Edge

Type
  Array

#### setColor(color) → {Edge}

Set the color of the Edge

##### Parameters:

Name | Type | Description
--- | --- | ---
`color` | Number | String | Hexadecimal or CSS-style string representation of a color

Source:
  - graphosaurus_src/graphosaurus.js, line 71545

##### Returns:

The Edge the method was called on

Type
  Edge

##### Examples

    myEdge.setColor(0x00ffbb);

    myEdge.setColor("rgb(250,0,0)");

    myEdge.setColor("green");

#### setNodes(nodes) → {Edge}

Set the nodes of the Edge

##### Parameters:

Name | Type | Description
--- | --- | ---
`nodes` | Array | Array of two Nodes

Source:
  - graphosaurus_src/graphosaurus.js, line 71515

##### Returns:

The Edge the method was called on

Type
  Edge