1 /** \file 2 * \brief Auxiliary data structure for (node,int) pair. 3 * 4 * \author Stefan Hachul 5 * 6 * \par License: 7 * This file is part of the Open Graph Drawing Framework (OGDF). 8 * 9 * \par 10 * Copyright (C)<br> 11 * See README.md in the OGDF root directory for details. 12 * 13 * \par 14 * This program is free software; you can redistribute it and/or 15 * modify it under the terms of the GNU General Public License 16 * Version 2 or 3 as published by the Free Software Foundation; 17 * see the file LICENSE.txt included in the packaging of this file 18 * for details. 19 * 20 * \par 21 * This program is distributed in the hope that it will be useful, 22 * but WITHOUT ANY WARRANTY; without even the implied warranty of 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 * GNU General Public License for more details. 25 * 26 * \par 27 * You should have received a copy of the GNU General Public 28 * License along with this program; if not, see 29 * http://www.gnu.org/copyleft/gpl.html 30 */ 31 32 33 #pragma once 34 35 #include <ogdf/basic/Graph.h> 36 37 namespace ogdf { 38 namespace energybased { 39 namespace fmmm { 40 41 //! Data structure for representing nodes and an int value (needed for class ogdf/list) 42 //! to perform bucket sort. 43 class Node 44 { value(const Node & A)45 friend int value(const Node& A) { return A.value; } 46 47 friend std::ostream &operator<< (std::ostream & output,const Node & A) 48 { 49 output <<"node index "; 50 if(A.vertex == nullptr) 51 output<<"nil"; 52 else 53 output<<A.vertex->index(); 54 output<<" value "<< A.value; 55 return output; 56 } 57 58 friend std::istream &operator>> (std::istream & input,Node & A) { 59 input >> A.value; 60 return input; 61 } 62 63 public: 64 //! Constructor Node()65 Node() { vertex = nullptr; value = 0; } 66 set_Node(node v,int a)67 void set_Node(node v,int a) { vertex = v; value = a; } get_value()68 int get_value() const { return value; } get_node()69 node get_node() const { return vertex; } 70 71 private: 72 node vertex; 73 int value ; 74 }; 75 76 } 77 } 78 } 79