Glauber Dynamics in C
Simulation for Glauber Dynamics written in C11
weightedgraph.h
Go to the documentation of this file.
1
7#include <stdio.h>
8#include "vertex.h"
9
15typedef struct graph {
16 int n;
17 int m;
21
25
32void graph_free(graph *g);
33
42void graph_add_n_vertices(graph *g, int n);
43
50void graph_add_edge(graph *g, int v1, int v2, int weight);
51
60void graph_rm_edge(graph *g, int v1, int v2);
61
62
84graph *graph_construct_torus(int n, int d, int init_weight);
85
127void draw_torus2png(graph *draw_torus, int n, int d, unsigned int duration,
128 FILE *out_stream, int max_width, int max_height, int max_dpi,
129 int penwidth, double passed_time);
Edge struct to be used as edges in the graph structs.
Definition: edge.h:10
The graph struct containing the pointers to edges and vertices.
Definition: weightedgraph.h:15
vertex ** vertices
List of vertex pointers for vertices contained in the graph.
Definition: weightedgraph.h:18
int m
The number of edges in the graph.
Definition: weightedgraph.h:17
edge ** edges
List of edge pointers for vertices contained in the graph.
Definition: weightedgraph.h:19
int n
The number of vertices in the graph.
Definition: weightedgraph.h:16
The vertex struct containing the neighbouring edges as pointers.
Definition: vertex.h:16
Define the vertex struct and functions relating to it.
void graph_rm_edge(graph *g, int v1, int v2)
Searches for an edge connecting v1 and v2 and removes it.
Definition: weightedgraph.c:82
void graph_add_edge(graph *g, int v1, int v2, int weight)
Connect vertices with index v1 and v2 with an edge of weight weight.
Definition: weightedgraph.c:59
struct graph graph
The typedef of the graph struct.
void draw_torus2png(graph *draw_torus, int n, int d, unsigned int duration, FILE *out_stream, int max_width, int max_height, int max_dpi, int penwidth, double passed_time)
Output a png rendering of draw_torus to out_stream.
Definition: weightedgraph.c:158
void graph_free(graph *g)
Free all the memory contained in the graph.
Definition: weightedgraph.c:24
graph * graph_construct_torus(int n, int d, int init_weight)
Allocate memory for a square lattice with periodic boundary conditions (i.e. a torus).
Definition: weightedgraph.c:116
graph * graph_new()
Allocate memory for an empty graph.
Definition: weightedgraph.c:18
void graph_add_n_vertices(graph *g, int n)
Add n newly created empty vertices to the graph.
Definition: weightedgraph.c:50