Well, I just figured it out. In the unlikely event that anyone else has this problem, the issue was with the giant loop in the middle. By separating the sorting of points into their specific instances and the checking of those instances against every other instance, it runs just fine. Fixed code is below.
Code:
#include <iostream>
#include <fstream>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <vector>
using namespace std;
int main()
{
//I've gotten rid of the code that reads the file and converts that data
//into edges, to make this easier to read. I know that part works fine.
//E = Number of triangles
//N = Number of points
vector<int> Newalg (9*E,0); //3 edges per triangle * 3 spaces per edge (two for endpoints, one to mark duplicates)
vector<int> Newcheck (N,0);
int temp1 = 0;
int temp2 = 0;
//write all edges to newalg:
for (int i=0;i<3*E;i++)
{
Newalg[3*i] = Edges[2*i];
Newalg[3*i+1] = Edges[2*i+1];
temp1 = Edges[2*i] - 1;
temp2 = Edges[2*i+1] - 1;
Newcheck[temp1] += 1;
Newcheck[temp2] += 1;
};
//find max instances of any one point
int inst = 0;
for (int i=0;i<N;i++)
{
if (Newcheck[i] > inst)
{
inst = Newcheck[i];
};
};
vector<int> Instances (inst*N,0); //This allows one to compare edges only with those edges in which the same point apppears
temp1 = 0;
temp2 = 0;
for (int i=0;i<N;i++)
{
Newcheck[i] = 0; //resets vector for use in next loop
};
int temp3 = 0; //placeholder value for stacking vectors
for (int i=0;i<3*E;i++)
{
temp1 = Newalg[3*i]-1;
temp2 = Newalg[3*i+1]-1;
temp3 = Newcheck[temp1];
Instances[inst*temp1+temp3] = i+1;
Newcheck[temp1]++;
temp3 = Newcheck[temp2];
Instances[inst*temp2+temp3] = i+1;
Newcheck[temp2]++;
};
for (int i=0;i<N;i++)
{
for (int j=0;j<inst-1;j++)
{
temp1 = Instances[inst*i+j]-1;
for (int k=j+1;k<inst;k++)
{
temp2 = Instances[inst*i+k]-1;
if ((Newalg[3*temp1] == Newalg[3*temp2]) && (Newalg[3*temp1+1] == Newalg[3*temp2+1]))
{
Newalg[3*temp1+2] = 1;
Newalg[3*temp2+2] = 1;
};
};
};
};
for (int i=0;i<3*E;i++)
{
temp1 = Newalg[3*i]-1;
temp2 = Newalg[3*i+1]-1;
if (fabs(Var[6*temp1]) > 3 || fabs(Var[6*temp1+1]) > 3 || (fabs(Var[6*temp1]) > 3 && fabs(Var[6*temp1+1]) > 3))
{
Newalg[3*i+2] = 1;
};
if (fabs(Var[6*temp2]) > 3 || fabs(Var[6*temp2+1]) > 3 || (fabs(Var[6*temp2]) > 3 && fabs(Var[6*temp2+1]) > 3))
{
Newalg[3*i+2] = 1;
};
};
//eliminate all rows with "1" in third column
temp3 = 0;
for (int i=0;i<3*E;i++)
{
if (Newalg[3*i+2] > 0)
{
Newalg[3*i] = 0;
Newalg[3*i+1] = 0;
Newalg[3*i+2] = 0;
temp3++;
};
};
//compress
//-make a counter set at zero
int newcount = 0;
//-as loop runs, fill data in from behind
//-if line==0, move it to counter*3 (deleting third row would be tricky and unnecessary)
//-for each instance of a remaining edge found, counter++
for (int i=0;i<3*E;i++)
{
if (Newalg[3*i] != 0)
{
Newalg[3*newcount] = Newalg[3*i];
Newalg[3*newcount+1] = Newalg[3*i+1];
Newalg[3*i] = 0;
Newalg[3*i+1] = 0;
newcount++;
};
};
cout<<newcount<<" edges remain."<<endl;
};
Thanks for looking at this anyway!