#pragma once /* Copyright (c) 2017 Swarthmore College Computer Science Department, Swarthmore PA A. Danner, M. Gagne, J. Brody, Z. Palmer, A. Soni Distributed as course material for Fall 2017 CPSC 035: Data Structures and Algorithms */ /** * An Edge is a class that represents a directed, weighted edge in a graph. * It is templated on three types. * @tparam V a type to represent the vertex labels * @tparam E a type to represent the edge labels * @tparam W a type to represent the weight (usually an int, float, or double) */ template <typename V, typename E, typename W> class Edge { public: Edge(V source, V destination, E label, W weight = 1); E getLabel() { return m_label; } V getSource() { return m_source; } V getDestination() { return m_dest; } W getWeight() {return m_weight; } private: V m_source; V m_dest; W m_weight; E m_label; }; template <typename V, typename E, typename W> Edge<V,E,W>::Edge(V source, V dest, E label, W weight) { m_source = source; m_label = label; m_weight = weight; m_dest = dest; }