

#ifndef POSTANALYZE_H
#define POSTANALYZE_H

#include <LINK/algorithm/Partitioning.h>
#include <LINK/algorithm/Algorithms.h>
#include <LINK/graph/Attribute.h>
#include <LINK/graph/Vertex.h>
#include <LINK/graph/Graph.h>
#include <LINK/basic/Set.h>
#include <LINK/basic/Sequence.h>
#include <LINK/generator/Generators.h>
#include <iostream.h>
#include <fstream.h>
#include <strstream.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define UNPLACED 2
#define RIGHT 1
#define LEFT 0
#define GREEDY 0
#define NONGREEDY 1

extern Set<Vertex*> set_of_doom;

Sequence<Vertex*> PostAnalyze(Graph*, Set<Vertex*> s1 = set_of_doom, int = 0);

void init_post(Graph*);

int count_cuts(VertexInfo*);

BucketArray* InitPostAnalyze(Graph*, VertexInfo*, int, int&);

VertexInfo* FindCandidate(Graph*, BucketArray*);

void Refine(BucketArray*, VertexInfo*, int);
 
Graph* GetNumbers(int, double, int, int, int, int);


void PartitioningLayout(Graph*);

Set<Vertex*> PlacedPartitions(Graph *, int);

int find_distribution(int, double, int, char*, long);
 
char* format(char*, int, double);

char* form_path(char*, char*);

void initialize_file(const char*, fstream&, int, int&, int*); 

void write_data(int, int, int*, fstream&);

Graph* Extract(Graph*, int, int, Sequence<Vertex*>, int = 0);

int SearchNgVertex(Sequence<Vertex*>, double, int, int);

void log(char*, int, double, int, char*, int);

Graph* ExtractNGInducedGraph(int, double, int, int, int = 1);

void ExtractGraphs(int, double, int, int, int, int);

void log_graph(int, double, Graph*, int);

int rank_comparison(const VertexPtr&, const VertexPtr&);

void Extract_SaveGraphs(int, double, int, int, int, int, int);

void write_graph(Graph*, int, double, int, int, int, int);

char* get_path(int, double, int, char*, char*, int);

char* attempt_file(char*, int, double, int, char*, char*, int);

#endif
 
