Esempio n. 1
0
BOOLEAN PositiveExample(Graph *graph, Graph **subGraphs,
                        ULONG numSubGraphs, Parameters *parameters)
{
   ULONG i = 0;
   BOOLEAN found = FALSE;
   InstanceList *instanceList = NULL;

   while ((i < numSubGraphs) && (! found)) 
   {
      instanceList = FindInstances(subGraphs[i], graph, parameters);
      if (instanceList->head != NULL)
         found = TRUE;
      FreeInstanceList(instanceList);
      i++;
   }
   return found;
}
Esempio n. 2
0
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
 	HANDLE pwp_mutex = CreateMutex(NULL, true, "pwp_mutex");
	if (pwp_mutex == NULL)
	{
		DebugOutput("mutex null");
		return 1;
	}

	int status;
	if (GetLastError() == ERROR_ALREADY_EXISTS)
	{
		DebugOutput("mutex exists");
	}
	else
	{
		DWORD pids[256];
		__try
		{
			int pidCount;
			while (true)
			{
				pidCount = FindInstances("elementclient.e", pids);
				if (pidCount == 0)
				{
					DebugOutput("no client");
					__leave;
				}
				Sleep(4000);
				status = DetectAndKillCheats();
				Sleep(11000);
			}
		}
		__finally
		{

		}
	}

	return !(CloseHandle(pwp_mutex) != 0);
}
Esempio n. 3
0
int main(int argc, char **argv)
{
   Parameters *parameters;
   ULONG numLabels;
   Graph *g1;
   Graph *g2;
   Graph *g2compressed;
   InstanceList *instanceList;
   ULONG numInstances;
   ULONG subSize, graphSize, compressedSize;
   double subDL, graphDL, compressedDL;
   double value;
   Label label;

   parameters = GetParameters(argc, argv);
   g1 = ReadGraph(argv[argc - 2], parameters->labelList,
                  parameters->directed);
   g2 = ReadGraph(argv[argc - 1], parameters->labelList,
                  parameters->directed);
   instanceList = FindInstances(g1, g2, parameters);
   numInstances = CountInstances(instanceList);
   printf("Found %lu instances.\n\n", numInstances);
   g2compressed = CompressGraph(g2, instanceList, parameters);

   // Compute and print compression-based measures
   subSize = GraphSize(g1);
   graphSize = GraphSize(g2);
   compressedSize = GraphSize(g2compressed);
   value = ((double) graphSize) /
           (((double) subSize) + ((double) compressedSize));
   printf("Size of graph = %lu\n", graphSize);
   printf("Size of substructure = %lu\n", subSize);
   printf("Size of compressed graph = %lu\n", compressedSize);
   printf("Value = %f\n\n", value);

   // Compute and print MDL based measures
   numLabels = parameters->labelList->numLabels;
   subDL = MDL(g1, numLabels, parameters);
   graphDL = MDL(g2, numLabels, parameters);
   numLabels++; // add one for new "SUB" vertex label
   if ((parameters->allowInstanceOverlap) &&
       (InstancesOverlap(instanceList)))
      numLabels++; // add one for new "OVERLAP" edge label
   compressedDL = MDL(g2compressed, numLabels, parameters);
   // add extra bits to describe where external edges connect to instances
   compressedDL += ExternalEdgeBits(g2compressed, g1, numInstances);
   value = graphDL / (subDL + compressedDL);
   printf("DL of graph = %f\n", graphDL);
   printf("DL of substructure = %f\n", subDL);
   printf("DL of compressed graph = %f\n", compressedDL);
   printf("Value = %f\n\n", value);

   if (parameters->outputToFile)
   {
      // first, actually add "SUB" and "OVERLAP" labels
      label.labelType = STRING_LABEL;
      label.labelValue.stringLabel = SUB_LABEL_STRING;
      StoreLabel(& label, parameters->labelList);
      label.labelValue.stringLabel = OVERLAP_LABEL_STRING;
      StoreLabel(& label, parameters->labelList);
      parameters->posGraph = g2compressed;
      WriteGraphToDotFile(parameters->outFileName, parameters);
      printf("Compressed graph written to dot file %s\n",
             parameters->outFileName);
   }

   FreeGraph(g2compressed);
   FreeInstanceList(instanceList);
   FreeGraph(g1);
   FreeGraph(g2); 
   FreeParameters(parameters);

   return 0;
}