INGOR
ytNetwork.h
1/*
2 net/ytNetwork.{h,c} : Network
3 Copyright (C) 2018, Yoshinori Tamada <tamada A T ytlab.jp>
4 All rights reserved.
5
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions
8 are met:
9
10 * Redistributions of source code must retain the above copyright
11 notice, this list of conditions and the following disclaimer.
12
13 * Redistributions in binary form must reproduce the above copyright
14 notice, this list of conditions and the following disclaimer in
15 the documentation and/or other materials provided with the
16 distribution.
17
18 * Neither the name of Kyoto University nor the names of its
19 contributors may be used to endorse or promote products derived
20 from this software without specific prior written permission.
21
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 POSSIBILITY OF SUCH DAMAGE.
34*/
35
36#ifndef __YTLIB_NETWORK_H
37#define __YTLIB_NETWORK_H
38
39#include "math/ytGraph.h"
40#include "util/ytArray.h"
41#include "net/ytNode.h"
42#include "net/ytEdge.h"
43
44typedef struct ytNetwork_t ytNetwork;
45
47void ytNetwork_delete(ytNetwork * this);
48void ytNetwork_dump(ytNetwork * this, FILE * fp);
49int ytNetwork_numNodes(const ytNetwork * this);
50int ytNetwork_numGraphNodes(const ytNetwork * this);
51void ytNetwork_setGraph(ytNetwork * this, ytGraph * g);
53void ytNetwork_addNode(ytNetwork * this, ytNode * node);
54ytNode * ytNetwork_getNode(const ytNetwork * this, int j);
55ytNode * ytNetwork_setNode(ytNetwork * this, int j, ytNode * node);
56int ytNetwork_degree(const ytNetwork * this, int j);
57int ytNetwork_numParents(const ytNetwork * this, int j);
58int ytNetwork_maxParents(const ytNetwork * this);
59int ytNetwork_numChildren(const ytNetwork * this, int j);
60int ytNetwork_numEdges(const ytNetwork * this);
61const int * ytNetwork_getParents(const ytNetwork * this, int j);
62ytNode * ytNetwork_getParent(const ytNetwork * this, int j, int k);
63int ytNetwork_getParentId(const ytNetwork * this, int j, int k);
64void ytNetwork_setProperty(ytNetwork * this, const char * key, ytObject * value);
65ytObject * ytNetwork_getProperty(const ytNetwork * this, const char * key);
66int ytNetwork_getPropertySize(const ytNetwork * this);
67const char * ytNetwork_getPropertyKey(const ytNetwork * this, int i);
68ytObject * ytNetwork_getPropertyAt(const ytNetwork * this, int i);
69int ytNetwork_findNode(const ytNetwork * this, const char * name);
70ytObject * ytNetwork_getNodeProperty(ytNetwork * this, int j, const char * key);
71void ytNetwork_setNodeProperty(ytNetwork * this, int j, const char * key, ytObject * value);
72void ytNetwork_setEdge(ytNetwork * this, ytEdge * edge);
73ytEdge * ytNetwork_getEdge(ytNetwork * this, int u, int v);
74ytEdge * ytNetwork_getEdgeConst(const ytNetwork * this, int u, int v);
75ytEdge * ytNetwork_removeEdge(ytNetwork * this, int u, int v);
76
77#include "util/ytMPI.h"
78void ytNetwork_MPI_Bcast(ytNetwork ** pNetwork, int root, MPI_Comm comm);
79
80int ytNetwork_test(int argc, char * argv[]);
81
82#endif /* __YTLIB_NETWORK_H */
Network edge.
Interface class for handling graph structure.
Network abstraction.
ytNetwork * ytNetwork_new()
Generates a ytNetwork instance.
Definition: ytNetwork.c:83
ytNode * ytNetwork_getParent(const ytNetwork *this, int j, int k)
Returns the parent of the specified node.
Definition: ytNetwork.c:247
ytObject * ytNetwork_getProperty(const ytNetwork *this, const char *key)
Returns the property value associated with the specified key.
Definition: ytNetwork.c:277
void ytNetwork_setEdge(ytNetwork *this, ytEdge *edge)
Sets the ytEdge instance.
Definition: ytNetwork.c:339
int ytNetwork_numParents(const ytNetwork *this, int j)
Returns the number of parents.
Definition: ytNetwork.c:207
ytNode * ytNetwork_getNode(const ytNetwork *this, int j)
Returns the ytNode instance at the specified index.
Definition: ytNetwork.c:158
void ytNetwork_MPI_Bcast(ytNetwork **pNetwork, int root, MPI_Comm comm)
[MPI] Broadcasts the ytNetwork instance with MPI.
Definition: ytNetwork.c:559
int ytNetwork_numChildren(const ytNetwork *this, int j)
Return the number of children.
Definition: ytNetwork.c:227
ytEdge * ytNetwork_removeEdge(ytNetwork *this, int u, int v)
Removes an edge.
Definition: ytNetwork.c:441
void ytNetwork_setGraph(ytNetwork *this, ytGraph *g)
Sets the ytGraph instance as the structure.
Definition: ytNetwork.c:134
ytNode * ytNetwork_setNode(ytNetwork *this, int j, ytNode *node)
Replaces the ytNode instance.
Definition: ytNetwork.c:169
ytEdge * ytNetwork_getEdgeConst(const ytNetwork *this, int u, int v)
Returns the ytEdge instance.
Definition: ytNetwork.c:410
int ytNetwork_numGraphNodes(const ytNetwork *this)
Returns the number of nodes in the ytGraph instance set to this network.
Definition: ytNetwork.c:187
ytGraph * ytNetwork_getGraph(const ytNetwork *this)
Returns the ytGraph instance set as the structure.
Definition: ytNetwork.c:140
int ytNetwork_numNodes(const ytNetwork *this)
Returns the added ytNode instances.
Definition: ytNetwork.c:180
void ytNetwork_setProperty(ytNetwork *this, const char *key, ytObject *value)
Sets a property value with its key.
Definition: ytNetwork.c:268
int ytNetwork_maxParents(const ytNetwork *this)
Returns the maximum number of parents.
Definition: ytNetwork.c:216
int ytNetwork_numEdges(const ytNetwork *this)
Returns the number of edges.
Definition: ytNetwork.c:235
ytEdge * ytNetwork_getEdge(ytNetwork *this, int u, int v)
Returns the ytEdge instance.
Definition: ytNetwork.c:374
int ytNetwork_degree(const ytNetwork *this, int j)
Returns the degree of the specified node.
Definition: ytNetwork.c:197
void ytNetwork_addNode(ytNetwork *this, ytNode *node)
Adds the ytNode instance.
Definition: ytNetwork.c:150
int ytNetwork_getParentId(const ytNetwork *this, int j, int k)
Returns the index of the parent of the node.
Definition: ytNetwork.c:255
int ytNetwork_findNode(const ytNetwork *this, const char *name)
Returns the index of the node which has the specified name.
Definition: ytNetwork.c:304
void ytNetwork_delete(ytNetwork *this)
Deletes the ytNetwork instance.
Definition: ytNetwork.c:96
The basis class.
Definition: ytNetwork.c:48
Network node.
Definition: ytNode.h:42