EXPECTED ROUTING OVERHEAD FOR LOCATION SERVICE IN MANETS UNDER FLAT GEOGRAPHIC ROUTING

Embed Size (px)

DESCRIPTION

Mobile Ad Hoc Networks (MANETs) have become one of the most highly researched areas in wireless local area networking. The current research in MANETs involves all layers in the TCP/IP model, as the very nature of these networks demands new design rules for each layer in order to provide client end-to end communications. MANETs are made up of a number of nodes, such as laptops and Personal Digital Assistance (PDA), which are capable of communicating with each other without using a base station. This means that each node performs routing in a distributed manner.

Citation preview

1

55

CHAPTER 1

INTRODUCTION1.1 COMPANY PROFILE As the training arm of HCL career development center (HCLCDC) carries forth a legacy excellence spanning across more than three decades. HCL is a $5 billion leading global Technology and IT Enterprise that comprises two companies listed in India - HCL Technologies & HCL Info systems. The 3-decade-old Enterprise, founded in 1976, is one of India's original IT garage start-ups. Its range of offerings spans Product Engineering, Custom & Package Applications, BPO, IT Infrastructure Services, IT Hardware, Systems Integration, and distribution of ICT products. Among the fastest growing IT education brands in India, HCL CDC offers a complete spectrum of quality training programs on software, hardware, networking as well as global certifications in association with leading IT organizations worldwide.HCL PRODUCTS The Engineering and R & D services department runs the largest outsourced engineering center outside the US which is a testimony to the 30 year product engineering experience. The company offers a comprehensive range of R&D and Engineering services to component vendors, OEMs, ODMs and ISVs across multiple industry segments and domains. Design and development of world-class

Dedicated to the planning

Customer relationship management

Product Engineering & Technology Development

Networking and Network Integration Network management involves network monitoring of bandwidth utilization, network errors, collisions, network trouble shooting day-to-day network operations, network performance monitoring, tuning network operating system and advice action plan.IT Services HCL info system portfolio of products covers the entire spectrum of the information technology needs of its customers.HCL info systems product offerings include everything from high end enterprise level servers.Networking and communication Architecture Company goal is to: Combine knowledge, technology and innovation to develop cost-effective solutions Conduct business in way that mutually benefits both customers and employees Adhere to exemplary moral standards in all relationshipHCL Key Technology Associates Computing software Network security Office automation Telecom, Microsoft Ms-project, Oracle data warehousing, storage sun server

OUR VISION "Together we create the enterprises of tomorrow".OUR MISSION "To provide world-class information technology solutions and services in order to enable our customers to serve their customers better".IT Infrastructure Consulting HCL assists with the design, selection and implementation the IT infrastructure that guarantees required performance, security, availability and scalability. High level Design, Prototyping and implementation Server Architecture and clustering Service Messaging strategies Security Consulting Selection of hardware and software server platforms ,DBMS servers and remote communication platformsQuality Assurance "To help people in HCL Info systems Ltd. share in the company's successes, which they make possible; to provide job security based on their performance; to recognize their individual achievements; and help them gain a sense of satisfactionand accomplishment from their work.We shall develop and impart Industry relevant ICT Education to meet the requirement of customers, Industry and society by continually updating technology content and improving our processes"

1.2 OBJECTIVE: Mobile Ad Hoc Networks (MANETs) have become one of the most highly researched areas in wireless local area networking. The current research in MANETs involves all layers in the TCP/IP model, as the very nature of these networks demands new design rules for each layer in order to provide client end-to end communications. MANETs are made up of a number of nodes, such as laptops and Personal Digital Assistance (PDA), which are capable of communicating with each other without using a base station. This means that each node performs routing in a distributed manner. The limitation in transmission range and the highly dynamic nature of these networks makes data transmission between the source and the destination travel over multiple hops, which can vary over time. Therefore, routing in MANETs is a challenging task. In the MANET literature, a number of different routing protocols have been proposed. Designing routing strategies for MANETs began by optimizing the routing protocols designed for wired networksThe route discovery in these protocols were proactive in nature, which means that each protocol periodically exchanged routing information with other nodes in the network, in order to build their routing tables. However, this approach to routing lacks scalability as the size of the network grows. On-demand routing protocols were designed to reduce the route discovery overheads by allowing each node to determine routes when they are required, rather than maintaining a route to every destination.

CHAPTER 2

SYSTEM ANALYSIS

2.1 EXISTING SYSTEM Routing overhead due to location information collection and retrieval in mobile ad-hoc networks employing geographic routing with no hierarchy. In the existing system, the problem of characterizing the minimum routing overhead as a rate-distortion problem. Mobile users are provided with access to real-time information even when they are away from their home or office Wireless networks offer more flexibility and adapt easily to changes in the configuration. 2.1.1 Draw backs Expensive to maintain the network due to many cables between computer systems and even if a failure in the cables occur then it will be very hard to replace that particular cable as it involved more and more costs.

When using a laptop which is required to be connected to the network, a wired.

Network will limit the logical reason of purchasing a laptop in the first place. Interference due to weather, other radio frequency devices, or obstructions like walls.

2.2 PROPOSED SYSTEM

In the proposed system, we create a new framework for quantifying overhead due to control messages generated to exchange location information. We compute the minimum number of bits required on average to describe the locations of a node, borrowing tools from information theory. The main source of in efficiency of proactive and reactive geographic routing as well as the major contributors to routing overhead in MANETs. Network can be extended to places which cannot be wired.

KEY TERMS

Data communications Network management Routing protocols. Mobile communication system

2.3 FEASIBILITY STUDY The feasibility of the project is analyzed in this phase and business proposal is put forth with a very general plan for the project and some cost estimates. For feasibility analysis, some understanding of the major requirements for the system is essential. Three key considerations involved in the feasibility analysis are ECONOMICAL FEASIBILITY SOCIAL FEASIBILITY TECHNICAL FEASIBILITY2.3.1 ECONOMICAL FEASIBILITY This study is carried out to check the economic impact that the system will have on the organization. The amount of fund that the company can pour into the research and development of the system is limited. The expenditures must be justified. 2.3.2 SOCIAL FEASIBILITY The aspect of study is to check the level of acceptance of the system by the user. This includes the process of training the user to use the system efficiently. The user must not feel threatened by the system, instead must accept it as a necessity. 2.3.3 TECHNICAL FEASIBILITY This study is carried out to check the technical feasibility, that is, the technical requirements of the system. Any system developed must not have a high demand on the available technical resources. This will lead to high demands on the available technical resources. The developed system must have a modest requirement, as only minimal or null changes are required for implementing this system.

CHAPTER 3

REQUIREMENT SPECIFICATIONS

3.1 HARDWARE REQUIREMENTS

1. Hard disk:40 GB1. RAM:512MB1. Processor:Pentium IV1. Monitor :17Color Monitor

3.2 SOFTWARE REQUIREMENTS

0. Front-End : VB .NET 20050. Coding Language : C#0. Operating System : Windows XP. Back End : SQLSERVER 2005

CHAPTER 4

SOFTWARE DESCRIPTION 4.1 FRONT END.NET

ASP.NET is a new way to program dynamic and interactive Web applications. .NET is a compiled environment that makes extensive use of the Microsoft .NET Framework, and the entire .NET platform is available to any .NET application. Microsoft .NET is a set of Microsoft software technologies for rapidly building and integrating XML Web services, Microsoft Windows-based applications, and Web solutions. The .NET Framework is a language-neutral platform for writing programs that can easily and securely interoperate. Theres no language barrier with .NET: there are numerous languages available to the developer including Managed C++, C#, Visual Basic and Java Script. The .NET framework provides the foundation for components to interact seamlessly, whether locally or remotely on different platforms. It standardizes common data types and communications protocols so that components created in different languages can easily interoperate. NET is also the collective name given to various software components built upon the .NET platform. These will be both products (Visual Studio.NET and Windows.NET Server, for instance) and services (like Passport, .NET My Services, and so on).

THE .NET FRAMEWORK

The .NET Framework has two main parts: 1. The Common Language Runtime (CLR). 2. A hierarchical set of class libraries. The CLR is described as the execution engine of .NET. It provides the environment within which programs run. The most important features are: Conversion from a low-level assembler-style language, called Intermediate Language (IL), into code native to the platform being executed on.

FEATURES OF THE .NET FRAMEWORK

Managed Code - is code that targets .NET, and which contains certain extra information - metadata - to describe itself. Whilst both managed and unmanaged code can run in the runtime, only managed code contains the information that allows the CLR to guarantee, for instance, safe execution and interoperability Managed Data - With Managed Code comes Managed Data. CLR provides memory allocation and Deal location facilities, and garbage collection. Some .NET languages use Managed Data by default, such as C#, Visual Basic.NET and JScript.NET, whereas others, namely C++, do not. Targeting CLR can, depending on the language youre using, impose certain constraints on the features available. Common Type System - The CLR uses something called the Common Type System (CTS) to strictly enforce type-safety. This ensures that all classes are compatible with each other, by describing types in a common way. CTS define how types work within the runtime, which enables types in one language to interoperate with types in another language, including cross-language exception handling. As well as ensuring that types are only used in appropriate ways. Common Language Specification - The CLR provides built-in support for language interoperability. To ensure that you can develop managed code that can be fully used by developers using any programming language, a set of language features and rules for using them called the Common Language Specification (CLS) has been defined. Components that follow these rules and expose only CLS features are considered CLS-compliant.

INTRODUCTION TO SQL SERVER: To create a database determines the name of the database, its owner (the user who creates the database), its size, and the files and file groups used to store it.Before creating a database, consider that: Permission to create a database defaults to members of the system admin and decretory fixed server roles, although permissions can be granted to other users. The user who creates the database becomes the owner of the database. A maximum of 32,767 databases can be created on a server. The name of the database must follow the rules for identifiers. Three types of files are used to store a database: Primary files These files contain the startup information for the database. The primary files are also used to store data. Every database has one primary file Secondary files These files hold all the data that does not fit in the primary data file. Databases do not need secondary data files if the primary file is large enough to hold all the data in the database. Some databases may be large enough to need multiple secondary data files, or they may use secondary files on separate disk drives to spread the data across multiple disks.Transaction log These files hold the log information used to recover the database. There must be at least one transaction log file for each database, although there may be more than one. The minimum size for a log file is 512 kilobytes (KB).

CREATING DATABASE PLAN The first step in creating a database is creating a plan that serves both as a guide to be used when implementing the database and as a functional specification for the database after it has been implemented. The complexity and detail of a database design is dictated by the complexity and size of the database application as well as the user population. In planning the database, regardless of its size and complexity, use these basic steps: Gather information. Identify the objects. Model the objects. Identify the types of information for each object.Gathering Information

It is also important to identify what they want the new system to do, as well as to identify the problems, limitations, and bottlenecks of any existing system. Collect copies of customer statements, inventory lists, management reports, and any other documents that are part of the existing system, because these will be useful to you in designing the database and the interfaces.

Identifying Objects During the process of gathering information, you must identify the key objects or entities that will be managed by the database. The object can be a tangible thing, such as a person or a product, or it can be a more intangible item, such as a business transaction, a department in a company, or a payroll period. There are usually a few primary objects, and after these are identified, the related items become apparent. Each distinct item in your database should have a corresponding table.

Modeling the Objects As the objects in the system are identified, it is important to record them in a way that represents the system visually. You can use your database model as a reference during implementation of the database. For this purpose, database developers use tools that range in technical complexity from pencils and scratch paper to word processing or spreadsheet programs.

Identify the types of information for each object

After the primary objects in the database have been identified as candidates for tables, the next step is to identify the types of information that must be stored for each object. These are the columns in the object's table. The columns in a database table contain a few common types of information

SQL-Server Database: Its consist of six type of objects, TABLE QUERY FORM REPORT MACRO

4.2 FEATURES

NAMESPACES ASP.NET uses a concept called namespaces. Namespaces are hierarchical object models that support various properties and methods. For example, HTML server controls reside in"System.web.Html Controls namespace, web server controls reside in System.web.UI.WebControls" namespace and ADO+ resides in "System. Data namespace. LANGUAGE INDEPENDENT An ASP.NET page can be created in any language supported by .NET framework. Currently .NET framework supports VB, C#, Script and Managed C++. ASP.NET SERVER CONTROLS Using ASP.NET Server Controls, browser variation is handled because these controls output the HTML themselves based on the browser requesting the page.TYPES OF CONTROLS ASP.NET has two basic types of controls: HTML server controls and Web server controls.HTML Server Controls are generated around specific HTML elements and the ASP.NET engine changes the attributes of the elements based on server-side code that you provide. Web server controls revolve more around the functional you need on the page. The ASP.NET engine takes the extra steps to decide based upon the container of the requester, what HTML to output.

CHAPTER 5

PROJECT DESCRIPTION

5.1 PROBLEM DEFINITION MANETs there have been several suggestions for location services ranging from simple flooding based services to hierarchical services. These location services have been classified according to MANET based on how location servers are selected and queried. A major difference between the flooding-based location services and the mapping based services are the number of nodes acting as location servers.

A MANET( Mobile Ad-hoc Network ) where node B sends a signal to node A but this does not tell anything about the quality of the connection in the reverse direction Routing Overhead: In wireless ad hoc networks, nodes often change their location within network. So, some stale routes are generated in the routing table which leads to unnecessary routing overhead. This is the major problem with mobile ad-hoc networks as links come and go depending on the transmission characteristics, one transmission might

5.2 OVERVIEW OF THE PROJECT A mobile ad-hoc network (MANET) is a collection of mobile nodes that construct and maintain a network without a centralized authority. Unlike in a more traditional wired network (e.g., the Internet), there are no dedicated routers or switches responsible for forwarding packets; instead, every node participates in relaying packets. In addition, since nodes are assumed mobile, one-hop connectivity between nodes and the network topology can change over time. Consequently, underlying routing protocols are asked to cope with potentially frequent changes in topology. Recently there has been much research on understanding the network transport throughput, or simply transport throughput, of multi-hop wireless networks.5.3 MODULE DESCRIPTION5.3.1 MODULES 1. Login 2. Network Formation 3. Send data using geographic routing 4. Receiving data 5. Expected overhead

Login This is the module to Expected Routing Overhead for Location Service in MANETs under Flat Geographic Routing

Network Formation A mobile ad hoc network (MANET) is a collection of mobile nodes that construct and maintain a network without a centralized authority. Un like in a more traditional wired network (e.g., the Internet), there are no dedicated routers or switches responsible for forwarding packets instead, every node participates in relaying packets.

Send data using geographic routing

Proactive and reactive routing, and suggested that control overhead is proportional to the square of the number of nodes in the network. We assume that nodes employ flat geographic position-based routing without designated location servers that maintain the location information of mobile nodes.

Receiving data

Receive the data by the destination node there has been much research on understanding the network transport throughput, or simply transport throughput, of multi hop wireless networks: In their seminal paper Gupta and Kumar investigated the transport throughput of static multi hop wireless networks and showed that the transport throughput increases, at best, as p with an increasing number of nodes n.Expected overhead

This result is then used to demonstrate that the expected overhead is where n is the number of nodes, under both proactive and reactive geographic routing, with the assumptions that nodes mobility is independent, and nodes adjust their transmission range to maintain network connectivity. Finally, we prove that the minimum expected overhead under the same assumptions is _on logon pp

5.4 Data Flow Diagram: A graphic picture of the logical steps and sequence involved in a procedure or a program is called a flow chart. Unlike detailed flowchart, Data Flow Diagrams do not supply detailed description of the modules but graphically describes a systems data and how the data interact with the system. To construct a Data Flow Diagram, we use, Arrow Circles Open End Box Squares An arrow identifies the data flow in motion. It is a pipeline through which information is flown like the rectangle in the flowchart. A circle stands for process that converts data into information. An open-ended box represents a data store, data at rest or a temporary repository of data. A square defines a source or destination of system data. Four rules for constructing a Data Flow Diagram 1. Arrows should not cross each other. 2. Squares, circles and files must bear names. 3. Decomposed data flow squares and circles can have same names. 4. Choose meaningful names for data flow LEVEL 0

Sending data using geographic routing Network formation

Receiving data Login

Expected overhead Fig 5.4.1 Network FormationLEVEL 1Network formation

Login

Sending data using geographic routing

Expected overheadReceiving data Nodes

Fig 5.4.2 Geographic routing

LEVEL 2

Network formation

Login

Sending data using geographic routing Receiving data Throughput Throughput increase Expected overhead

Fig 5.4.3 Sending the data to receiving data

5.5 ER DIAGRAM

Network formation

Sending data using geographic routing Login

Expected overheadReceiving data

Fig 5.5 ER Diagram

5.5.1 Use Case Diagram

User Login Network formation Sending data using geographic routingReceiving dataExpected overhead

Fig 5.5.1 Use Case Diagram

5.5.2 Activity Diagram

Login

Network formation

Sending data using geographic touting Yes No

Receiving data

Expected overhead

Fig 5.5.2 Activity Diagram

5.5.3 COLLABARATION DIAGRAM

LoginNetwork formationSending data using geographic routing Expected overheadReceiving data

Fig 5.5.3 Collaboration Diagram

5.6 INPUT DESIGN

Input design is the process of converting user-originated inputs to a computer-based format. Input design is one of the most expensive phases of the operation of computerized system and is often the major problem of a system. In the project, the input design is made in various web forms with various methods. For example, in the Admin form, the empty username and password is not allowed. The username if exists in the database, the input is considered to be invalid and is not accepted. Likewise, during the Download process, the download images, videos, documents, songs will be noted.5.7 OUTPUT DESIGN Output design generally refers to the results and information that are generated by the system for many end-users; output is the main reason for developing the system and the basis on which they evaluate the usefulness of the application. In the project, the output is to create the new folders, invite friends and download the files in the website.

CHAPTER 6

SYSTEM TESTING

The purpose of testing is to discover errors. Testing is the process of trying to discover every conceivable fault or weakness in a work product. It provides a way to check the functionality of components, sub assemblies, assemblies and/or a finished product it is the process of exercising software. Software system meets its requirements and user expectations and does not fail in an unacceptable manner. There are various types of test. Each test type addresses a specific testing requirement.TYPES OF TESTS

6.1 UNIT TESTING Unit testing verification efforts on the smallest unit of software design, module. This is known as Module Testing. The modules are tested separately. This testing is carried out during programming stage itself. In these testing steps, each module is found to be working satisfactorily as regard to the expected output from the module. Unit testing is conducted to verify the functional performance of each modular component of the software. Unit testing focuses on the smallest unit of the software design (i.e.), the module. As developing a driver program, the test modules by developed or used. After the lower level modules were tested, the modules that the next higher level those make use of the lower modules were tested each module was tested against required functionality and test cases were developed to test boundary values.

6.2 USER ACCEPTANCE TESTING Acceptance testing is a final stage of testing that is performed on a system prior to the system being delivered to a live environment. Systems subjected to acceptance testing might include such deliverables as a software system or a mechanical hardware system. Acceptance tests are generally performed as "black box" tests. Black box testing means that the tester uses specified inputs into the system and verifies that the resulting outputs are correct, without knowledge of the system's internal workings. The system under consideration is tested for user acceptance by constantly keeping in touch with prospective system and user at the time of developing and making changes whenever required. This is done in regarding to the following points. Input screen design. Output screen design.

6.3 SYSTEM TESTING Testing is performed to identify errors. It is used for quality assurance. Testing is an integral part of the entire development and maintenance process. The goal of the testing during phase is to verify that the specification has been accurately and completely incorporated into the design, as well as to ensure the correctness of the design itself. For example the design must not have any logic faults in the design is detected before coding commences, otherwise the cost of fixing the faults will be considerably higher as reflected. Detection of design faults can be achieved by means of inspection as well as walkthrough. A test case in software engineering is a set of conditions or variables under which a tester will determine whether an application or software system is working correctly or not.

CHAPTER 7

SYSTEM IMPLEMENTATION7.1 Implementation Procedure Implementation is the stage of the project when the theoretical design is turned out into a working system. Thus it can be considered to be the most critical stage in achieving a successful new system and in giving the user, confidence that the new system will work and be effective The implementation stage involves careful planning, investigation of the existing system and its constraints on implementation, designing of methods to achieve changeover and evaluation of changeover methods. Implementation is the process of converting a new system design into operation. It is the phase that focuses on user training, site preparation and file conversion for installing a candidate system. The important factor that should be considered here is that the conversion should not disrupt the functioning of the organization.Implementation of the Software System Its should be replace a manual system the problems encountered are converting files, training users creating accurate files, and verifying printouts for integrityImplementation of New Software System Its should be replace an existing one this is usually a difficult conversion. if not properly planned there can be many problems. Some large computer system have taken even years to convert

CHAPTER 8

CONCLUSION & FUTURE ENHANCEMENT

8.1 CONCLUSION

It is concluded that the application works well and satisfy the end users. The application is tested very well and errors are properly debugged. The application is simultaneously accessed from more than one system. Simultaneous login from more than one place is tested. Further enhancements can be made to the application, so that the application functions very attractive and useful manner than the present one. The speed of the transactions become more enough now.

8.2 ENHANCEMENT The project has covered almost all the requirements. Further requirements and improvements can easily be done since the coding is mainly structured or modular in nature. Improvements can be appended by changing the existing modules or adding new modules. One important development that can be added to the project in future is file level backup, which is presently done for folder level.

CHAPTER 9

APPENDIX9.1 SOURCE CODESqlConnection cn = new SqlConnection("server=.;integrated security=true;database=evoting;"); cn.Open() SqlCommandcmd1=newSqlCommand("select*fromreg Name='"+txb_UName.Text.Trim()+"'",cn); SqlDataReader dr = cmd1.ExecuteReader(); if (!dr.Read()) { dr.Close();SqlCommand cmd = new SqlCommand("insert reg values ('" + txb_UName.Text + "','" + txb_Pass.Text + "','" + txb_Mail.Text + "','" + txb_Mobile.Text + "')", cn);cmd.ExecuteNonQuery();MessageBox.Show("Created Successfully!","Information",MessageBoxButtons.OK,MessageBoxIcon.Asterisk); Welcome we = new Welcome(); we.Show(); this.Hide(); }

Login Coding

SqlConnection cn = new SqlConnection("server=.;integrated security=true;database=evoting;"); SqlCommand cmd = new SqlCommand("select * from reg where Name='"+txb_UName.Text+"' and Password='"+txb_Password.Text+"' ",cn); cn.Open(); SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()){MessageBox.Show("Welcome: " + txb_UName.Text, "Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);Routing_Graph rg = new Routing_Graph(); rg.Show(); this.Hide(); } else{MessageBox.Show("Invalid UserName or Password!","Alert!",MessageBoxButtons.OK,MessageBoxIcon.Error);}

Nodes Identification Coding StreamReader streamReader = new string line; listBox1.Items.Add(""); while ((line = streamReader.ReadLine()) != null) { if (line.StartsWith("\\")) { //Node_No++; string name = (line.Substring(2).Substring(0, line.Substring(2).IndexOf(" ")).ToUpper());

//listBox1.Items.Add(tot_node+":"+name);

IPHostEntry ipEntry = Dns.GetHostEntry(name); IPAddress[] iparrAddr = ipEntry.AddressList; if (iparrAddr.Length > 0) for (int intloop = 0; intloop < iparrAddr.Length; intloop++) { listBox1.Items.Add(tot_node + " : " + name + " -> " + iparrAddr[intloop].ToString()); cn.Open(); SqlCommand cmd4 = new SqlCommand("insert into LDetails (Node,NodeNo) values ('"+name+"','"+tot_node.ToString()+"')",cn); cmd4.ExecuteNonQuery(); cn.Close(); } tot_node++; listBox1.Items.Add(""); }

Greddy Method formation

using System;using System.Drawing;using System.Drawing.Drawing2D;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;using System.IO;using System.Runtime.Serialization;using System.Runtime.Serialization.Formatters.Binary;using EMK.Cartography;using System.Data.SqlClient;using System.Diagnostics;using System.Net;namespace GraphFormer{/// /// Summary description for Form1./// public class Routing_Graph : System.Windows.Forms.Form{ int tot_node = 0;OpenFileDialog op = new OpenFileDialog();#region Construction / Destructionprivate ContextMenu MenuContextuel;APropos DialogueAPropos = new APropos();private FlickerFreePanel GraphPanel;private System.Windows.Forms.ImageList ImagesActions;private System.Windows.Forms.ImageList ImagesPasAPas;private System.Windows.Forms.ToolBar FichierToolBar;private System.Windows.Forms.ImageList ImagesFichier; private System.Windows.Forms.ToolBarButton Sep1;private System.Windows.Forms.Label LabelAide;private System.Windows.Forms.ToolBarButton BoutonNouveau;private System.Windows.Forms.ToolBarButton BoutonDessiner;private System.Windows.Forms.ToolBarButton BoutonEffacer;private System.Windows.Forms.ToolBarButton BoutonDeplacer;private System.Windows.Forms.ToolBarButton BoutonChangerEtat;private System.Windows.Forms.ToolBarButton BoutonAEtoile;private System.Windows.Forms.ToolBar EditionToolBar;private System.ComponentModel.IContainer components;static int Rayon = 7;static int Epaisseur = 1;static Pen CrayonNoeuds;static Pen CrayonArcs;static Pen CrayonNoeudsInactifs;static Pen CrayonArcsInactifs;static Pen CrayonTemp;static Pen CrayonChemin;private StatusBarPanel CoordsPanel;private StatusBarPanel NbArcsPanel;private StatusBarPanel NbNodesPanel;private StatusBar GraphStatusBar;public ListBox listBox1;private Label label1;private Label lbl_Info; private Timer timer_Check private Button button1; static Pen CrayonArcsPas;

static Routing_Graph() { CrayonNoeuds = new Pen(Color.Black, Epaisseur); CrayonNoeudsInactifs = new Pen(Color.Gray, Epaisseur); CrayonArcs = new Pen(Color.Black, Epaisseur); CrayonArcs.EndCap = LineCap.Custom; CrayonArcs.CustomEndCap = new AdjustableArrowCap(3, 6, true); CrayonArcsInactifs = new Pen(Color.Gray, Epaisseur); CrayonArcsInactifs.EndCap = LineCap.Custom; CrayonArcsInactifs.CustomEndCap = new AdjustableArrowCap(3, 6, true); CrayonTemp = new Pen(Color.Gray, Epaisseur); CrayonTemp.DashStyle = DashStyle.Dash; CrayonChemin = new Pen(Color.DarkTurquoise, 3); CrayonChemin.DashStyle = DashStyle.Dot; CrayonArcsPas = new Pen(Color.LawnGreen, 3); CrayonArcsPas.EndCap = LineCap.Custom; CrayonArcsPas.CustomEndCap = new AdjustableArrowCap(4, 8, true); } public Routing_Graph() { MenuContextuel = new ContextMenu(); MenuContextuel.MenuItems.Add(new MenuItem("Automatic", new MenuContextuel.MenuItems.Add(new MenuItem("Step by step", new InitializeComponent(); BoutonAEtoile.DropDownMenu = MenuContextuel; G = new Graph(); NouveauGraphe(); Mode = Action.Dessiner; } }

RECEVING DATA using System;using System.Collections;namespace EMK.Collections{/// /// The SortableList allows to maintain a list sorted as long as needed./// If no IComparer interface has been provided at construction, then the list expects the Objects to implement IComparer./// If the list is not sorted it behaves like an ordinary list./// When sorted, the list's "Add" method will put new objects at the right place./// As well the "Contains" and "IndexOf" methods will perform a binary search./// [Serializable]public class SortableList : IList, ICloneable{private ArrayList _List;private IComparer _Comparer;private bool _UseObjectsComparison;private bool _IsSorted;private bool _KeepSorted;private bool _AddDuplicates;

/// /// Default constructor./// Since no IComparer is provided here, added objects must implement the IComparer interface./// public SortableList() { InitProperties(null, 0); }

/// /// Constructor./// Since no IComparer is provided, added objects must implement the IComparer interface./// /// Capacity of the list (ArrayList.Capacity)public SortableList(int Capacity) { InitProperties(null, Capacity); }

/// /// Constructor./// /// Will be used to compare added elements for sort and search operations. public SortableList(IComparer Comparer) { InitProperties(Comparer, 0); }

/// /// Constructor./// /// Will be used to compare added elements for sort and search operations./// Capacity of the list (ArrayList.Capacity)public SortableList(IComparer Comparer, int Capacity) { InitProperties(Comparer, Capacity); }

/// /// 'Get only' property that indicates if the list is sorted./// public bool IsSorted { get { return _IsSorted; } }

/// /// Get : Indicates if the list must be kept sorted from now on./// Set : Tells the list if it must stay sorted or not. Impossible to set to true if the list is not sorted./// KeepSorted==true implies that IsSorted==true/// /// Cannot be set to true if the list is not sorted yet.public bool KeepSorted{set{if ( value==true && !_IsSorted ) throw new InvalidOperationException("The SortableList can only be kept sorted if it is sorted.");KeepSorted = value;}get { return _KeepSorted; }}

/// /// If set to true, it will not be possible to add an object to the list if its value is already in the list./// public bool AddDuplicates { set { _AddDuplicates = value; } get { return _AddDuplicates; } }

/// /// IList implementation./// Gets - or sets - object's value at a specified index./// The set operation is impossible if the KeepSorted property is set to true./// /// Index is less than zero or Index is greater than Count./// [] operator cannot be used to set a value if KeepSorted property is set to true.public object this[int Index]{get{if ( Index>=_List.Count || Index=_List.Count || Index0 ? _List[Index-1] : null;object OAfter = Index0 || OAfter!=null && _Comparer.Compare(value, OAfter)>0 ) _IsSorted = false;_List[Index] = value;}}}

/// /// IList implementation./// If the KeepSorted property is set to true, the object will be added at the right place./// Else it will be added at the end of the list./// /// The object to add./// The index where the object has been added./// The SortableList is set to use object's IComparable interface, and the specifed object does not implement this interface.public int Add(object O){int Return = -1;if ( ObjectIsCompliant(O) ){if ( _KeepSorted ){int Index = IndexOf(O);int NewIndex = Index>=0 ? Index : -Index-1;if (NewIndex>=Count) _List.Add(O);else _List.Insert(NewIndex, O);Return = NewIndex;}Else{IsSorted = false;Return = _List.Add(O);}}return Return;}

/// /// IList implementation./// Search for a specified object in the list./// If the list is sorted, a BinarySearch is performed using IComparer interface./// Else the Object.Equals implementation is used./// /// The object to look for/// true if the object is in the list, otherwise false.public bool Contains(object O){return _IsSorted ? _List.BinarySearch(O, _Comparer)>=0 : _List.Contains(O);}

/// /// IList implementation./// Returns the index of the specified object in the list./// If the list is sorted, a BinarySearch is performed using IComparer interface./// Else the Object.Equals implementation of objects is used./// /// The object to locate./// /// If the object has been found, a positive integer corresponding to its position./// If the objects has not been found, a negative integer which is the bitwise complement of the index of the next element./// public int IndexOf(object O){int Result = -1;if ( _IsSorted ){Result = _List.BinarySearch(O, _Comparer);while ( Result>0 && _List[Result-1].Equals(O) ) Result--; // We want to point at the FIRST occurence}else Result = _List.IndexOf(O);return Result;}public void Insert(int Index, object O){if ( _KeepSorted ) throw new InvalidOperationException("Insert method cannot be called if KeepSorted property is set to true.");if ( Index>=_List.Count || Index= 0 ){ if ( NbValuesToKeep0 ) break; // No need to follow}}

public void RemoveDuplicates(){int PosIt;if (_IsSorted){PosIt = 0;while ( PosIt=0 ){PosIt = Left+1;while (PosIt>0){if ( Left!=PosIt && _Comparer.Compare(this[Left], this[PosIt])==0 ) RemoveAt(PosIt);else PosIt++;}Left++;}}}public int IndexOfMin(){int RetInt = -1;if ( _List.Count>0 ){RetInt = 0;object RetObj = _List[0];if ( !_IsSorted ){for ( int i=1; i0 ){ RetObj = _List[i]; RetInt = i; } }}return RetInt;} public int IndexOfMax() { int RetInt = -1; if ( _List.Count>0 ) { RetInt = _List.Count-1; object RetObj = _List[_List.Count-1]; if ( !_IsSorted ) { for ( int i=_List.Count-2; i>=0; i-- ) if ( _Comparer.Compare(RetObj, _List[i])