~ubuntu-branches/ubuntu/lucid/igraph/lucid

« back to all changes in this revision

Viewing changes to src/drl_graph.h

  • Committer: Bazaar Package Importer
  • Author(s): Mathieu Malaterre
  • Date: 2009-11-16 18:12:42 UTC
  • Revision ID: james.westby@ubuntu.com-20091116181242-mzv9p5fz9uj57xd1
Tags: upstream-0.5.3
ImportĀ upstreamĀ versionĀ 0.5.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// The graph class contains the methods necessary to draw the
 
2
// graph.  It calls on the density server class to obtain
 
3
// position and density information
 
4
 
 
5
#include "DensityGrid.h"
 
6
#include "igraph.h"
 
7
 
 
8
namespace drl {
 
9
 
 
10
// layout schedule information
 
11
struct layout_schedule {
 
12
        int iterations;
 
13
        float temperature;
 
14
        float attraction;
 
15
        float damping_mult;
 
16
        time_t time_elapsed;
 
17
};
 
18
 
 
19
class graph {
 
20
 
 
21
public:
 
22
 
 
23
    // Methods
 
24
        void init_parms ( int rand_seed, float edge_cut, float real_parm );
 
25
        void init_parms ( const igraph_layout_drl_options_t *options );
 
26
        void read_parms ( char *parms_file );
 
27
        void read_real ( char *real_file );
 
28
        int read_real ( const igraph_matrix_t *real_mat, 
 
29
                        const igraph_vector_bool_t *fixed);
 
30
        void scan_int ( char *filename );
 
31
        void read_int ( char *file_name );
 
32
        void draw_graph ( int int_out, char *coord_file );
 
33
        int draw_graph (igraph_matrix_t *res);
 
34
        void write_coord ( const char *file_name );
 
35
        void write_sim ( const char *file_name );
 
36
        float get_tot_energy ( );
 
37
        
 
38
        // Con/Decon
 
39
        graph( int proc_id, int tot_procs, char *int_file );
 
40
                ~graph( ) { }
 
41
        graph( const igraph_t *igraph, 
 
42
               const igraph_layout_drl_options_t *options,
 
43
               const igraph_vector_t *weights);
 
44
        
 
45
private:
 
46
 
 
47
        // Methods
 
48
        int ReCompute ( );
 
49
        void update_nodes ( );
 
50
        float Compute_Node_Energy ( int node_ind );
 
51
        void Solve_Analytic ( int node_ind, float &pos_x, float &pos_y );
 
52
        void get_positions ( vector<int> &node_indices, float return_positions[2*MAX_PROCS] );
 
53
        void update_density ( vector<int> &node_indices,
 
54
                                                                 float old_positions[2*MAX_PROCS],
 
55
                                                                 float new_positions[2*MAX_PROCS] );
 
56
        void update_node_pos ( int node_ind,
 
57
                                      float old_positions[2*MAX_PROCS],
 
58
                                      float new_positions[2*MAX_PROCS] );
 
59
                                                                  
 
60
        // MPI information
 
61
        int myid, num_procs;
 
62
        
 
63
        // graph decomposition information
 
64
        int num_nodes;                                  // number of nodes in graph
 
65
        float highest_sim;                              // highest sim for normalization
 
66
        map <int, int> id_catalog;              // id_catalog[file id] = internal id
 
67
        map <int, map <int, float> > neighbors;         // neighbors of nodes on this proc.
 
68
        
 
69
        // graph layout information
 
70
        vector<Node> positions;  
 
71
        DensityGrid density_server;
 
72
  
 
73
        // original VxOrd information
 
74
        int STAGE, iterations;
 
75
        float temperature, attraction, damping_mult;
 
76
        float min_edges, CUT_END, cut_length_end, cut_off_length, cut_rate;
 
77
        bool first_add, fine_first_add, fineDensity;  
 
78
        
 
79
        // scheduling variables
 
80
        layout_schedule liquid;
 
81
        layout_schedule expansion;
 
82
        layout_schedule cooldown;
 
83
        layout_schedule crunch;
 
84
        layout_schedule simmer;
 
85
        
 
86
        // timing statistics
 
87
        time_t start_time, stop_time;
 
88
        
 
89
        // online clustering information
 
90
        int real_iterations;    // number of iterations to hold .real input fixed
 
91
        int tot_iterations;
 
92
    int tot_expected_iterations; // for progress bar
 
93
        bool real_fixed;
 
94
};
 
95
 
 
96
} // namespace drl