From charlesreid1

(Created page with "Note: this implementation is more practical for a lightweight problem, such as a programming competition or coding challenge.")
 
No edit summary
Line 1: Line 1:
Note: this implementation is more practical for a lightweight problem, such as a programming competition or coding challenge.
Note: this implementation is more practical for a lightweight problem, such as a programming competition or coding challenge.
Graph class:
* Constructor: initializes list of vertices, list of edges
* Add vertex method (identified by integers)
* Add edge method (takes two integers)
Vertex class:
* Map of Vertex objects to Edge objects, to store connecting edges
* Integer (element/identifier)
* Method: get neighbors
* Method: get element
Edge class:
* List of Vertex objects
* (Optional) int array (element/identifier)
* Constructor: two vertices, set as endpoints
* Method: get endpoints
* Method: get element
=Flags=
{{GraphsFlag}}

Revision as of 06:51, 17 October 2017

Note: this implementation is more practical for a lightweight problem, such as a programming competition or coding challenge.

Graph class:

  • Constructor: initializes list of vertices, list of edges
  • Add vertex method (identified by integers)
  • Add edge method (takes two integers)

Vertex class:

  • Map of Vertex objects to Edge objects, to store connecting edges
  • Integer (element/identifier)
  • Method: get neighbors
  • Method: get element

Edge class:

  • List of Vertex objects
  • (Optional) int array (element/identifier)
  • Constructor: two vertices, set as endpoints
  • Method: get endpoints
  • Method: get element




Flags